You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Renato Tegon Forti <re...@novaamerica.net> on 2005/01/14 18:34:52 UTC

Copy node (correction - pNode)

Hi All,

I trying copy node of documents, but I receive erro.

Can anyone help-me:

 

See my code:

 

            xercesc_2_6::DOMDocument* pDocThegiver =
m_pThegiverParser->getDocument();

            DOMElement* pRootThegiver = pDocThegiver->getDocumentElement();

 

            xercesc_2_6::DOMDocument* pDocReceptor =
m_pReceptorParser->getDocument();

            DOMElement* pRootReceptor = pDocReceptor->getDocumentElement();

 

      

            DOMNodeList* pNodeList = pRootThegiver->getChildNodes();

 

            for ( int i = 0 ; i <= (int)pNodeList->getLength() ; i++ ) 

            {

                  DOMNode* pNode = pNodeList->item(i);

 

                  if(pNode != NULL)

                  {

                        CString strNodeName = pNode->getNodeName();

                        if(strNodeName == "product")

                        {

                             pRootReceptor->appendChild(pNode); // here, I
receive error. Why?

                        }

                  }

            }

 

Node that I try copy

 

      <product>

            <productcontrol>

                  <id>{E5BF529A-9E34-4133-9035-7E5E903ADA46}</id>

                  <mdlid>{E5BF529A-9E34-4133-9035-7E5E903ADA45}</mdlid>

            </productcontrol>

      

            <generalinfo> 

                  <productname>Put your product name here.</productname>

                  <projectdescription>Put your project description
here.</projectdescription>

                  <detailedprojectdescription>Put your detailed project
description here.</detailedprojectdescription>

                  <maxquantity>0</maxquantity>

                  <difficulty>00,00</difficulty>

            </generalinfo>

            

            <rawmaterials>

                  <rawmaterial>

                        <id>{E5BF529A-9E34-4133-9035-7E5E903ADA49}</id>

                        <quantity>0</quantity>

                  </rawmaterial>

            </rawmaterials>

      </product>

 

Thaks