Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Question about php domelement objects
- George Thorogood
January 11, 2005, 3:07 am
rate this thread
Hello all. When I do a print_r of a domelement object I get something like this:
[type] => 1
[tagname] => category
 => 6
 => 1007543104
What are those "0" and "1" internal variables? I can not seem to find any
of them anywhere. What do they represent? The "0" one seems to stay constant
constant xml source. But the "1" one is always different though still unique.
these variables a php thing only? Or part of the dom specification that I
Also how do I access them? I can do a "$node->tagname" or "$node->type" just
get access to those internal object variables. But php does not like "$node->0"
What's the problem? Some kinda of variable scoping or something?
Lastly, I don't suppose there is any way to search by these "0" variables with an
The problem is this: I will be receiving an xml file with all these nested
elements. They only have "name" attributes, which unfortunately, I can not be
will be unique. But I still need some unique way to identify them. Short of
attributes to each "category" element, I was hoping to use this "0" internal
variable, or perhaps, the position() function from xpath. But I have no idea
determine an elements position when all I have is the domelement object.
Thanks for any help!
- Janwillem Borleffs
January 12, 2005, 4:46 am
Re: Question about php domelement objects
I was unable to reproduce this output, can you post a snippet which results
With an XPath expression, you can group category elements with equal values
for the name attributes:
If you want the first matching node, just do: