Hi all. I just found out out thie interesting confusion. I don;t know i am write or wrong, but can anyone explain this concept of "Siblings". If i have xml file like this: </GrandParent> <Parent1> <Child1> name1 </Child1> <Child2> name2 </Child2> </Parent1> <Parent2> <Child3> name3 </Child3> <Child4> name4 </Child4> </Parent2> </GrandParent> When i am using JAXP DOM parser, and my node is poiting to "Child1" of "Parent1", and i use node.getNextSibling() points me to "name1", not to "Child2" Isn't it confusing. Isn't "name1" is child of "Child1" Can anyone explain this concept. TIA L Goundalkar.
According to the DOM spec, the content of a node is considered another node. If the contents issimple text-data( as in your examle), it becomes a "text node". Text nodes have no child nodes. So, name1 is a child node of child1 and is of type text node. HTH ------------------ Ajith Kallambella M. Sun Certified Programmer for the Java�2 Platform. IBM Certified Developer - XML and Related Technologies, V1.
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
posted 17 years ago
Hi.. Ajith thats right. But do you agree isn;t this API more confusing and difficult to use. Also as i mentioned in the other thread, getNextSibling() and getPreviousSibling() functions doesn't follow the same rule. Is it a Bug in Java API ???