[RESOLVED] Object variable not set error while loading xml in domdocument
Dim strRelsAttrXML As String
Dim xdcAttrDoc As New MSXML2.DOMDocument
strRelsAttrXML = "<SText>bit.test_report_&_msg_in</SText>"
xdcAttrDoc.loadXML (strRelsAttrXML)
x = xdcAttrDoc.childNodes(0).Text
MsgBox x
Hi
Above code is not working as there is & in node text .
Help neeed. Urgent...
Thanks in advance
Re: Object variable not set error while loading xml in domdocument
It doesn't matter where you post it, the problem comes back to strRelsAttrXML containing an unescaped ampersand and therefore it is not valid XML.
Re: Object variable not set error while loading xml in domdocument
Enclose it in CDATA
"<SText>![CDATA[bit.test_report_&_msg_in]]</SText>"
Re: Object variable not set error while loading xml in domdocument
solved the problem by repalcing & in the node text with amp;
Re: Object variable not set error while loading xml in domdocument
Now that we've helped you, you can help us by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button which will let everyone know that you have your answer.