XML newbie here!
I have a file containing only the following XML:
<tags>
<tag>orange</tag>
<tag>apple</tag>
<tag>banana</tag>
</tags>
I want to ouput the tags alphabetically.
I am trying to use SimpleDOM library and its sortedXPath method. Here's what I have so far, which outputs the tags unsorted.
$allTags = simpledom_load_file("tags.xml");
foreach ($allTags->sortedXPath("//tags/tag", "tag") as $i => $item)
{
echo($item);
}
Could someone tell me how to write this correctly so it works? Cheers!