Jump to content

Need help with php dom parser

- - - - -

  • Please log in to reply
1 reply to this topic

#1
thatsme

thatsme

    Programmer

  • Members
  • PipPipPipPip
  • 176 posts
1) Hi. I use this row $new = $xmlDoc->getElementById($i); to get certain node of xml document. variable $i is already set. But the i try to use getElementsByTagName or getAttributeNode with $new object I always get error like that: Fatal error: Call to a member function getAttributeNode() on a non-object in C:\wamp\www\FTB\home.php on line 83. $xmlDoc is of type DOMDocument
.

Is there any way to solve such problem?
2) Is there any simple way to sort NodeList by attribute value?
Let's say my xml is like that:
<naujienuSarasas>
    <naujiena id="1">
     ....
    </naujiena>

    <naujiena id="3">
    ....
    </naujiena>

    <naujiena id="2">
     ....
    </naujiena>
    ....
</naujienuSarasas>

I need to sort nodes called "naujiena" by id value
I would be grateful if someone could help me.


Edited by thatsme, 14 July 2011 - 10:47 PM.


#2
thatsme

thatsme

    Programmer

  • Members
  • PipPipPipPip
  • 176 posts
already solved it myself :)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users