I have some sort of … xml document as below :
<file src="136090000-136100000">
<member id="136090000">
<Name>
<![CDATA[DOSEKUN DANIEL ADETUNJI]]>
</Name>
<Email>
<![CDATA[dosekun2d200@yahoo.com]]>
</Email>
<DateRegistration>
<![CDATA[10/19/2010 8:46:57 PM]]>
</DateRegistration>
</Member>
<usafisMember id="136090001">
<Name>
<![CDATA[yoleida colina]]>
</Name>
<Email>
<![CDATA[yole_g1972@hotmail.com]]>
</Email>
<DateRegistration>
<![CDATA[10/19/2010 8:47:08 PM]]>
</DateRegistration>
</usafisMember>
<usafisMember id="136090002">
<Name>
<![CDATA[Homero Valdovinos]]>
</Name>
<Email>
<![CDATA[felicida2d_9091@hotmail.com]]>
</Email>
<DateRegistration>
<![CDATA[10/19/2010 8:47:01 PM]]>
</DateRegistration>
</Member>
I need to extract the member id , name, email and DateRegistration but as you can see the xml is not very well formatted . I tried with simple xml which obviously doesn’t work but nether regex doesn’t seem to work . Here is the pattern that I tried :
$pattern = "/<Name><\\!\\[CDATA\\[(.*)\\]\\]><\/Name>/";
preg_match_all($pattern, $xml_content, $matches);
$name = $matches[1][0][v];
echo " name is $name ";
had to add close file but other wise worked as expected