Solved

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

Posted on 2008-06-10
1
334 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

705 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