Hello,
I am having trouble understanding the getNodeName and getNodeType functions.
I am trying a simple program just to understand the basics of xerces. My
code is below. I parse the xml doc and then call a function NodeDetails.
When I run it, I dont get the output I expected.
I have pasted below the xml file, the code and the output I am
getting........
If you can guide me a little, I would be very grateful.
Thank You
Sanat.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The XML file I am using is:
<?xml version="1.0" encoding="utf-8"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>
An in-depth look at creating applications
with XML.
</description>
</book>......................
-----------------------------------------------------------------------------------------
skeleton code is below:
DOMDocument* document = parser->getDocument();
NodeDetails(document);
void NodeDetails(DOMNode* node)
{
cout << "Node Type: "
<< node->getNodeType()
<< endl
<< "Node Name: "
<< (node->getNodeName())
<< endl;
if(node->hasChildNodes())
{
cout << "Child Node Type: "
<< node->getFirstChild()->getNodeType()
<< endl
<< "Node Name: "
<< (node->getFirstChild()->getNodeName())
<< endl;
}
-----------------------------------------------------------------------------------------------------------------------------------
Output:
Node Type: 9
Node Name: 1227DEAC
Child Node Type: 1
Node Name: 008DB2D4