473,320 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Question about php domelement objects


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 description
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. Are
these variables a php thing only? Or part of the dom specification that I missed?

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 "category"
elements. They only have "name" attributes, which unfortunately, I can not be guaranteed
will be unique. But I still need some unique way to identify them. Short of adding
attributes to each "category" element, I was hoping to use this "0" internal object
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!

Jul 17 '05 #1
1 2622
George Thorogood wrote:
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
I was unable to reproduce this output, can you post a snippet which results
in this?
But I have
no idea how to determine an elements position when all I have is the
domelement object.


With an XPath expression, you can group category elements with equal values
for the name attributes:

//category[@name='value']

If you want the first matching node, just do:

//category[@name='value'][1]
JW

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: petermichaux | last post by:
Hi, I'm trying the following code (ultimately I want a node with a URI like index.php?foo=1&bar) <?php $foo = new DomElement('foo','foo&bar'); ?>
4
by: David | last post by:
Hello , I'm trying to parse an XML document a get spicific tags such as email in the code below. I'm using xerces 2.4. However I don't manage to get the value for the email. Can anybody help. ...
4
by: Joseph Geretz | last post by:
Our company develops and markets a client/server application which is written in VB6 as a rich Win32 Client/Server application. For a variety of technological reasons we are looking to migrate...
3
by: pertheli | last post by:
Hello, I have a large array of pointer to some object. I have to run test such that every possible pair in the array is tested. eg. if A,B,C,D are items of the array, possible pairs are AB, AC,...
1
by: Tony Johansson | last post by:
Hello Experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that I don't understand completely. It says "A garbarage...
21
by: Jon Slaughter | last post by:
I have a class that is basicaly duplicated throughout several files with only members names changing according to the class name yet with virtually the exact same coding going on. e.g. class...
3
by: Miguel | last post by:
Hi all friends: It's said that Sessions objects in ASP 3.0 with IIS 5.0 occupy certain memory of the machine which take to take care about use a lot of Sessions objects in the ASPs pages of the...
7
by: heddy | last post by:
I have an array of objects. When I use Array.Resize<T>(ref Object,int Newsize); and the newsize is smaller then what the array was previously, are the resources allocated to the objects that are...
0
by: Meal | last post by:
The last line of the following codes makes the program crash. I cannot debug into the codes. It looks that I cannot use the dynamic_cast, but why? The cout shows that the node is DOM element node....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.