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:27:59 UTC
Copy node
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(productElem); //
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
Re: Copy node
Posted by Alberto Massari <am...@datadirect.com>.
Hi Renato,
I don't see where you define the "productElem" variable, so I cannot give
you a precise answer; but I have a couple of hypothesis
1) it is a pointer to something else (or to deleted memory), and you get an
access violation
2) it is a node coming from another DOM tree; in this case, you should have
used importNode
Alberto
At 15.27 14/01/2005 -0200, Renato Tegon Forti wrote:
>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(productElem); //
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org