CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Posts
    33

    Smile Generating XML Document using VC++

    Hi everyone,
    I have already posted many questions on XMLDOM using VC++.But i didnot get any answers to read a particular node or text in a XML Document.And also I need to read some of the items in the XML Document which i have alreay loaded with the LOAD Function and i Need to generate a new XML Document.In that Document i need to insert the items which i have readed from the old XML Document.Please anyone send me the sample codings for the above application.I kindly request you to send the reply.Thanks in advance.

  2. #2
    Join Date
    Nov 2001
    Posts
    17

    Re: Generating XML Document using VC++

    i hope this helps

    MSXML2::IXMLDOMDocumentPtr iXMLDoc;
    ... read the xml file into iXMLDoc ....
    iXMLDoc->save("newName.xml");

    to modify the text value of the nodes:

    MSXML2::IXMLDOMNodeListPtr plistanodos;
    MSXML2::IXMLDOMNodePtr pNodo;
    ....
    plistanodos=iXMLDoc->selectNodes("/NameOfXMLroot/NameOfLevel1\NaveOfLevel2"); // list of the child nodes at level /NameOfXMLroot/NameOf.... in the XML file

    for(i=0;i<plistanodos->length;i++)
    {
    plistanodos->get_item(i,&pNodo); // pNode has the i-th node of the list
    pNodo->put_text("modifyed value"); // modifying i-th node text <NameOfLevel2>text to be modified </NameOfLevel2>
    }

  3. #3
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: Generating XML Document using VC++

    Take a look at XML. You'll find some solutions there.

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