Hiho,
i guess, it's a pretty stupid question, but i had to switch to C/C++ recently and haven't done this in years. And right now I'm stuck on the following:
Given XML Element as a simple String:
<myns:factor>1000</myns:factor>
I have to parse the string, add the resulting Element to a surrounding MSXML2 DOM object within the same Namespace.
Right now i try it this way:
HRESULT hr;
MSXML2::IXMLDOMDocument2Ptr l_xmlFrame;
MSXML2::IXMLDOMElementPtr l_xmlFrameDoc;
hr = l_xmlFrame.CreateInstance(__uuidof(MSXML2::DOMDocument));
if( !FAILED(hr) ) {
l_xmlFrame->async = VARIANT_FALSE;
l_xmlFrame->validateOnParse = VARIANT_TRUE;
// p_strUnit holds the xml as a String
l_xmlFrame->loadXML(p_strUnit);
}
The loadXML(...) call just fails , but:
if i remove the namespace declarations and the element looks like this:
<factor>1000</factor>
the call works perfectly!
I really don't understand, why the loadXML function wont parse the string, when the Namespace declarations are set.
Any help appreciated!!!!! :)
Thanks!