Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CComboBox Question Pin
Ian Bowler16-Jun-05 10:45
Ian Bowler16-Jun-05 10:45 
GeneralRe: CComboBox Question Pin
LCI16-Jun-05 10:36
LCI16-Jun-05 10:36 
GeneralRe: CComboBox Question Pin
Ian Bowler16-Jun-05 10:46
Ian Bowler16-Jun-05 10:46 
GeneralRe: CComboBox Question Pin
David Crow16-Jun-05 10:57
David Crow16-Jun-05 10:57 
GeneralMFC Doc/View Pin
E Dyot16-Jun-05 10:12
E Dyot16-Jun-05 10:12 
GeneralRe: MFC Doc/View Pin
David Crow16-Jun-05 10:55
David Crow16-Jun-05 10:55 
GeneralRe: MFC Doc/View Pin
Member 142769216-Jun-05 13:49
Member 142769216-Jun-05 13:49 
GeneralXML Pin
LCI16-Jun-05 10:01
LCI16-Jun-05 10:01 
Ok, no kidding. I simply want to create a an xml file with the following content.

?xml version="1.0" encoding="UTF-8" ?
Form xmlns="urn:query" Sender="G" Software="Me"
AutoSend>Yes
ResponseKey PrintResponse="No" TwoWayXML="Yes">xvpqr7
FormName>RQ
Operator>
OperatorName>test
Password encryption="Cipher">000000000000
/Operator>
Fields>
Field>
FieldName>DRI
Value>GA
/Field>
Field>
FieldName>LIC
Value>ABC123
/Field>
Field>
FieldName>LIT
Value />
/Field>
Field>
FieldName>VMA
Value />
/Field>
/Fields>
/Form>


I am using the createNode function to create the nodes, however, after each node creation, i am appending and releasing.
This does not seem to work when it comes to my second node that i am appending.


_variant_t varTyp((short)MSXML2::NODE_ELEMENT);


HRESULT hr;
CoInitialize(NULL);
hr = pXMLDom. CreateInstance(__uuidof(DOMDocument40));
//Preserve whitespace
pXMLDom->preserveWhiteSpace = VARIANT_TRUE;


//Create Processing Instruction
pi = pXMLDom->createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
if (pi != NULL)
{
pXMLDom->appendChild(pi);
pi.Release();
}

//Create Node and append to Document
pNode=pXMLDom->createNode(varTyp,"Form","urn:query");

// Set pNode to a valid reference of some node
// Now cast it to IXMLDOMElement
pNode->QueryInterface(IID_IXMLDOMElement, (void**)&pDOMElement);
// Now use "pDOMElement" to add an attribte
pDOMElement->setAttribute("Sender","10");
pDOMElement->setAttribute("Software","Mine");


//Append to DOM Document
pXMLDom->appendChild(pNode);

//Release Node and element
pNode.Release();
pDOMElement.Release();

*****Here is where when i try to append again i get a com error on the appendChild call.


//Create AutoSend Node
if (SUCCEEDED(pNode=pXMLDom->createTextNode("AutoSend")));
if (SUCCEEDED(pNode->put_text (BSTR(L"Yes"))));

//Append to DOM Document
if (SUCCEEDED(pXMLDom->appendChild(pNode)));
//Release Node
pNode.Release();


Can anyone tell me what i am doing wrong or guide me to an example that would do nested nodes and attributes like the one that i am attempting to do..

Thanks,
GeneralRe: XML Pin
ThatsAlok17-Jun-05 2:38
ThatsAlok17-Jun-05 2:38 
GeneralUsing readfile() Pin
Camron16-Jun-05 9:48
Camron16-Jun-05 9:48 
GeneralRe: Using readfile() Pin
krmed16-Jun-05 10:06
krmed16-Jun-05 10:06 
GeneralProblem Reading Excel (.xls) file into VC++ Pin
CodeGoose16-Jun-05 9:01
CodeGoose16-Jun-05 9:01 
GeneralRe: Problem Reading Excel (.xls) file into VC++ Pin
GogglesPisano16-Jun-05 10:07
GogglesPisano16-Jun-05 10:07 
Generalfile access Pin
bkphat16-Jun-05 8:56
bkphat16-Jun-05 8:56 
GeneralRe: file access Pin
David Crow16-Jun-05 9:31
David Crow16-Jun-05 9:31 
GeneralCode beautifier - Lazy programmer looking for ideas Pin
Vaclav16-Jun-05 8:40
Vaclav16-Jun-05 8:40 
GeneralRe: Code beautifier - Lazy programmer looking for ideas Pin
Blake Miller16-Jun-05 12:49
Blake Miller16-Jun-05 12:49 
GeneralProblems with Dialog Controls in VS2003 Pin
NTense16-Jun-05 8:35
NTense16-Jun-05 8:35 
GeneralRe: Problems with Dialog Controls in VS2003 Pin
Wes Aday16-Jun-05 9:15
professionalWes Aday16-Jun-05 9:15 
GeneralRe: Problems with Dialog Controls in VS2003 Pin
NTense16-Jun-05 10:50
NTense16-Jun-05 10:50 
GeneralRe: Problems with Dialog Controls in VS2003 Pin
NTense16-Jun-05 10:55
NTense16-Jun-05 10:55 
GeneralRe: Problems with Dialog Controls in VS2003 Pin
Wes Aday16-Jun-05 11:00
professionalWes Aday16-Jun-05 11:00 
GeneralWaitForSingleObject() help Pin
kani9816-Jun-05 8:33
kani9816-Jun-05 8:33 
GeneralRe: WaitForSingleObject() help Pin
Blake Miller16-Jun-05 12:58
Blake Miller16-Jun-05 12:58 
GeneralRe: WaitForSingleObject() help Pin
Anonymous20-Jun-05 7:07
Anonymous20-Jun-05 7:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.