Question about php domelement objects

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hello all.  When I do a print_r of a domelement object I get something like this:

domelement Object
    [type] => 1
    [tagname] => category
    [0] => 6
    [1] => 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
with a
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
fine to
get access to those internal object variables.  But php does not like "$node->0"
at all.
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
xpath_eval statement?

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
how to
determine an elements position when all I have is the domelement object.

Thanks for any help!

Re: Question about php domelement objects

George Thorogood wrote:
Quoted text here. Click to load it

I was unable to reproduce this output, can you post a snippet which results
in this?

Quoted text here. Click to load it

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:



Site Timeline