Kware XML DOM
- Previous page DOM introduction
- Next page DOM node tree
Kowane ɗanin a cikin dokumentan XML yana da ɗanin.
ɗanin
Daga DOM, kowane ɗanin a cikin dokumentan XML yana da ɗaninɗanin.
DOM ana kira da haka:
- Dokumentan na kai tsaye yana da ɗanin
- Kowane tag XML yana da ɗanin
- Tarihin ɗanin yana da matsakaici
- Kowane ɗanin XML yana da matsakaici
- Rarrabu kasa ce rarrabu ɗanin
DOM ɗanin
Kaiko ci dominan XML fiilen (books.xml):
<?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book category="children"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="web"> <title lang="en">Learning XML</title> <author>Erik T. Ray</author> <year>2003</year> <price>39.95</price> </book> <book category="web"> <title lang="en">XQuery Kick Start</title> <author>James McGovern</author> <author>Per Bothner</author> <author>Kurt Cagle</author> <author>James Linn</author> <author>Vaidyanathan Nagarajan</author> <year>2003</year> <price>49.99</price> </book> </bookstore>
In the above XML, the root node is <bookstore>. All other nodes in the document are contained within <bookstore>.
The root node <bookstore> has four <book> nodes.
The first <book> node has four nodes: <title>, <author>, <year> and <price>, each of which contains a text node, "Harry Potter", "J K. Rowling", "2005" and "29.99".
Text is always stored in the text node
A common error in DOM processing is to think that the element node contains text.
However, the text of the element node is stored in the text node.
In this example:<year>2005</year>, the element node <year> has a text node with the value "2005".
"2005" Not The value of the <year> element!
- Previous page DOM introduction
- Next page DOM node tree