Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Create XML File

Create XML File

Scheduled Pinned Locked Moved XML / XSL
xmlquestionannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maynka
    wrote on last edited by
    #1

    I am writing the following code for creating the XML file. HRESULT hr; IXMLDOMDocumentPtr pXMLDoc = NULL; CoInitialize(NULL); hr=pXMLDoc.CreateInstance("msxml2.domdocument"); IXMLDOMNodePtr pRootNode= NULL; IXMLDOMNodePtr pRecNode= NULL; IXMLDOMNodePtr pRecNode1= NULL; IXMLDOMElementPtr pElement=NULL; _variant_t varNodeType((short)MSXML2::NODE_ELEMENT); hr= pXMLDoc->createNode(varNodeType, _T("RTCS"), _T("Remote Target Control System"),&pRootNode); hr=pXMLDoc->createElement(_T("Connection"),&pElement); IXMLDOMAttributePtr pRecIdAttr = NULL; IXMLDOMNamedNodeMapPtr pattributeMap; hr=pXMLDoc->createAttribute(_T("connect"),&pRecIdAttr); hr=pRecIdAttr->put_nodeTypedValue(_variant_t(_T("connect_val"))); hr=pElement->get_attributes(&pattributeMap); hr=pattributeMap->setNamedItem(pRecIdAttr,&pRecNode); hr=pXMLDoc->appendChild(pRootNode,&pRecNode); but i am not able to see the child node created in the xml file.Only root node is created: The xml file i want to create is: ?xml version="1.0"?>

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups