I'm going to make a wild guess that you're looking for, say, <name> elements in the document, then processing them. Then you do the same thing for <age> elements, and you need to make sure that "John" ends up with an age of "54" and not some other age.
If that's the case, I think you need to invert your processing model. Instead of searching for <name> and <age> elements, look for <person> elements and process the children of each one. All the children of a given <person> element will relate to the same person if your documents are rational. If I'm off base, maybe you should send a short code sample that demonstrates what you're trying to do. -----Original Message----- From: Nuno Ferreira [mailto:[EMAIL PROTECTED] Sent: Thursday, April 24, 2008 11:40 AM To: [email protected] Subject: Re: How to know a node position in the tree Hi, i'm using DOM and XPath from Xerces 3.0.0b Basically in the following example, I want to know that after the <age> tag, this person info is over and another one might come next. So i have to know that the second <person> tag comes first in the tree compared to <name> or <age>. Hope i made myself clear this time. Thanks. <population> <person> <name>John</name> <age>54</age> </person> <person> (...) </person> </population> On Fri, Apr 18, 2008 at 12:39 PM, Jesse Pelton <[EMAIL PROTECTED]> wrote: > I think you'll need to say a little more. Are you using DOM or SAX? > What do you mean by "one level behind?" Do you want to know if one node > is the parent of another? > > -----Original Message----- > From: Nuno Ferreira [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 16, 2008 2:40 PM > To: [email protected] > Subject: How to know a node position in the tree > > I tried a couple of tricks to see if a node is positioned one level > behind > in the tree but none of them worked. > > How to check if the current node is one level behind in the tree > compared to > the previous one? > > > Thank you. >
