chandranam
Programmer
Hi,
I am new to the XML. Learning from all tutorial site.
I want to count the number of sub-children with in a child. Also when i used the xmlDoc.documentElement.childNodes[1].childNodes.length, i got 9 instead of 4. How to count the sub-children length (of element book)?
Below is the xml code I am using.
<?xml version="1.0"?>
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
I am new to the XML. Learning from all tutorial site.
I want to count the number of sub-children with in a child. Also when i used the xmlDoc.documentElement.childNodes[1].childNodes.length, i got 9 instead of 4. How to count the sub-children length (of element book)?
Below is the xml code I am using.
<?xml version="1.0"?>
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>