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