Searching XML File
I have an XML file with around 20,000 records. For each record there is an element:
Now I would like to search through all records and return the country codes ideally in a separate text file...I am using Notepad++
Any ideas on how i can proceed?
thanks in advance,
You didn't give me enough to give you exact code, but here is a general method:
This is in php and is the only way I know.
First get your file as variable $xml:
then we use a foreach loop. You will have to drill down the elements until you hit <record>
$feed = file_get_contents("PUT THE URL HERE");
$xml = new SimpleXmlElement($feed);
Then inside of the loop:
foreach ($xml->records->record as $entry)
Should do it. Please give me feed back on this.
$namespaces = $entry->getNameSpaces(true);
$commons = $entry->children($namespaces['commons']);
echo $commons ->Country;