?
Solved

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

Posted on 2008-06-10
1
Medium Priority
?
335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

801 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