Nasıl bir düğüm değeri sıralamak için SimpleDOM sortedXPath kullanır?

0 Cevap php

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);
}

Birisi nasıl çalıştığını bu nedenle bu doğru yazmak için bana söyleyebilir misiniz? Şerefe!

0 Cevap