Solved

Do i need DOMDocument in order to append a new child node ?

Posted on 2008-06-10
1
325 Views
Last Modified: 2012-06-21
hi have this part of the xml in my class:

<carController>
      <car max="160" min="0"/>    
</carController>


i dont have a pointer to the DomDocument... anyway here is an example of what i tried instead, but it does not work:

xercesc::DOMElement *carController= getDOMConfig(); // this gives me MY CONFIG the one above
xercesc::DOMNode *newCar = carController->getFirstChild()->cloneNode( false );  // this doesnt work
xercesc::DOMElement *car = static_cast<xercesc::DOMElement *>(carController->
            appendChild( newCar ));  // therfore this wont work also.
// ... here comes the saving the changes stuff

I am lost in what else to do.

How can I create a newCar node, in order for me to insert it into my  carController node? Also If it doesnt have any child nodes yet.

Thank you.



0
Comment
Question by:Endelm
1 Comment
 

Accepted Solution

by:
Endelm earned 0 total points
ID: 21767135
i found it, i did like this:
xercesc::DOMElement *carController= getDOMConfig();
xercesc::DOMDocument *config = carController->getOwnerDocument;
xercesc::DOMElement *newCar = config->createElement(xercesc::XMLString::transcode("car"));
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now