Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Doubt in behaviour in methods of NodeList interface. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Doubt in behaviour in methods of NodeList interface." Watch "Doubt in behaviour in methods of NodeList interface." New topic
Author

Doubt in behaviour in methods of NodeList interface.

Arjun Karthick
Ranch Hand

Joined: Jan 04, 2007
Posts: 77
Hi All,
I use Java 1.5 API. I tried to get the child elements of a xml document by using getChildNodes() method of Node interface. This method reurns a NodeList. The getLength() method of NodeList interface will return the number of child elements in that particular node.

I tried this functionality for same xml node in two different forms. Both the xml documents were part of well formed xml document.

Case 1 :

The Node is Transforms.
The Number of child elements is : 2



Case 2 :

The Node is Transforms. But there is space or new line character between each node.
The Number of child elements is : 5



Can someone throw light on why the behaviour of the getLength() and item(int index) method of the NodeList interface change for the same Node but in different forms.

Regards,
Arjun.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in behaviour in methods of NodeList interface.
 
Similar Threads
Java 1.5 and XML Node.
Digital Signature Validation
can we get a signature element without linefeeds using apache xml security 1.4.1 ?
Certificate Signature Validation
Can we generate a signature element without linefeed using apache xml security 1.4.1?