CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Threaded View

  1. #1
    Join Date
    Jun 2002
    Posts
    78

    MSXML appending raw XML

    Hi all,

    I am using the MSXML library to process XML documents. I have a requirement to merge a raw XML fragment (from a string) into an existing document. Adding it under an arbitrary element. I've tried this:

    Code:
    MSXML2::IXMLDOMElementPtr current;
    wchar_t *xml_buffer;
    .
    .
    .
    MSXML2::IXMLDOMDocumentPtr doc;
    HRESULT hResult = doc.CreateInstance(__uuidof(MSXML2::DOMDocument40));
    if (SUCCEEDED(hResult)) {
        doc->loadXML(xml_buffer);
        MSXML2::IXMLDOMElementPtr new_sub = doc->documentElement;
        new_sub = doc->removeChild(new_sub);
        if (new_sub != NULL) {
            current->appendChild(new_sub);
        }
    }
    doc.Release();
    This throws an "Invalid Argument" exception.
    Is this even the way to go?
    While a "get_xml" member exists, "put_xml" is missing in action, I guess, so there must be a different way to do this.

    Thanks,
    Last edited by sperlis; February 7th, 2008 at 11:25 AM.
    sperlis

    "Let's code quickly now, so we'll have time to debug later"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured