Search found 2 matches
- Thu Nov 13, 2008 4:02 pm
- Forum: PHP - Code
- Topic: Sorting an xml file by its elements attribute via php
- Replies: 2
- Views: 291
Re: Sorting an xml file by its elements attribute via php
Actually i made this code <?php $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; $doc->load("news.rss"); $root = $doc->documentElement; $news= $root->getElementsByTagName('myItem'); function my_sort($a, $b) { return strcmp($a->getAttributeNode('id')->value, $b-...
- Thu Nov 13, 2008 4:54 am
- Forum: PHP - Code
- Topic: Sorting an xml file by its elements attribute via php
- Replies: 2
- Views: 291
Sorting an xml file by its elements attribute via php
Hi all, could you be so kind to help me solve a problem i have inverse sorting elements of a xml file by their attribute values? I have this xml file (news2.rss): <?xml version="1.0" encoding="iso-8859-1"?> <Menu> <myItem id="1" name="Item"/> <myItem id=&quo...