Link to home
Start Free TrialLog in
Avatar of Endelm
Endelm

asked on

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

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.



ASKER CERTIFIED SOLUTION
Avatar of Endelm
Endelm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial