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. Creating an attribute of a node

Creating an attribute of a node

Scheduled Pinned Locked Moved XML / XSL
helpc++linuxxmlquestion
2 Posts 2 Posters 3 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.
  • B Offline
    B Offline
    Bash
    wrote on last edited by
    #1

    Hi Gurus! I'm XML novice. Please, help me in a creating an attribute of a new node. I'm using VC++ 6.0. I want to get XML document as follows: Some name My problem is I can't create the attribute "Id" of node. What should I do ? My code is: VARIANT varNODEELEMENT; varNODEELEMENT.vt=VT_I2; varNODEELEMENT.iVal=NODE_ELEMENT; pNode=XmlDocPtr->createNode(varNODEELEMENT, L"Filter", L""); if (pNode==NULL) return; pNodeFilter=pNodeMain->appendChild(pNode); pNodeTmp=XmlDocPtr->createNode(varNODEELEMENT, L"Name", L""); if (pNodeTmp==NULL) return; _bstr_t tmpbstr("Some name"); pNodeTmp->put_dataType(L"NODE_TEXT"); pNodeTmp->put_text(tmpbstr); pNodeFilter->appendChild(pNodeTmp); Yours sincerely, Alex Bash

    C 1 Reply Last reply
    0
    • B Bash

      Hi Gurus! I'm XML novice. Please, help me in a creating an attribute of a new node. I'm using VC++ 6.0. I want to get XML document as follows: Some name My problem is I can't create the attribute "Id" of node. What should I do ? My code is: VARIANT varNODEELEMENT; varNODEELEMENT.vt=VT_I2; varNODEELEMENT.iVal=NODE_ELEMENT; pNode=XmlDocPtr->createNode(varNODEELEMENT, L"Filter", L""); if (pNode==NULL) return; pNodeFilter=pNodeMain->appendChild(pNode); pNodeTmp=XmlDocPtr->createNode(varNODEELEMENT, L"Name", L""); if (pNodeTmp==NULL) return; _bstr_t tmpbstr("Some name"); pNodeTmp->put_dataType(L"NODE_TEXT"); pNodeTmp->put_text(tmpbstr); pNodeFilter->appendChild(pNodeTmp); Yours sincerely, Alex Bash

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Does it need to be done this way ? Anyhow, I do know that an XmlAttribute is a seperate item which you can create and append to the Attributes collection of the node. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

      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