Click here to Skip to main content
16,005,181 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: ASCII to Hex Pin
jeron126-Jul-07 4:24
jeron126-Jul-07 4:24 
GeneralRe: ASCII to Hex Pin
AAKAra26-Jul-07 5:12
AAKAra26-Jul-07 5:12 
GeneralRe: ASCII to Hex Pin
CPallini26-Jul-07 5:25
mveCPallini26-Jul-07 5:25 
AnswerRe: ASCII to Hex Pin
Mark Salsbery26-Jul-07 5:15
Mark Salsbery26-Jul-07 5:15 
GeneralRe: ASCII to Hex Pin
AAKAra26-Jul-07 5:23
AAKAra26-Jul-07 5:23 
GeneralRe: ASCII to Hex Pin
Mark Salsbery26-Jul-07 6:31
Mark Salsbery26-Jul-07 6:31 
AnswerRe: ASCII to Hex Pin
toxcct26-Jul-07 5:35
toxcct26-Jul-07 5:35 
QuestionCode to create XML file Pin
Maynka26-Jul-07 4:08
Maynka26-Jul-07 4:08 
Hi all,
i am writing code to create XML file which looks like this:

<code><rtcs name="Remote Target Control System">
<connection connect="Server" ipaddress="" port="27015">
<logging directory="C:\RTCSLogs\log1.log" level="5" comport="27016" maxsize="1">

<ir directory_path="C:\signalDB.xml">


To accomplish above i have created code like this:

HRESULT hr;
IXMLDOMDocument2Ptr pXMLDoc = NULL;
CoInitialize(NULL);
hr=pXMLDoc.CreateInstance("DOMDocument.4.0");
MSXML2::IXMLDOMNodePtr pRootNode= NULL;
_variant_t varNodeType((short)MSXML2::NODE_ELEMENT);
pRootNode= pXMLDoc->createNode(varNodeType,
_T("RTCS"), _T("Remote Target Control System"));
pXMLDoc->appendChild(pRootNode);

MSXML2::IXMLDOMNodePtr pRecNode= NULL;
pRecNode = pRootNode->appendChild(pXMLDoc->createElement(_T("Connection")));

MSXML2::IXMLDOMAttributePtr pRecIdAttr = NULL;
pRecIdAttr = pXMLDoc->createAttribute(_T("connect"));
pRecIdAttr->nodeTypedValue = _T("connect_val");
pRecNode->attributes->setNamedItem(pRecIdAttr);

MSXML2::IXMLDOMAttributePtr pRecIdAttr1 = NULL;
pRecIdAttr1 = pXMLDoc->createAttribute(_T("ipaddress"));
pRecIdAttr1->nodeTypedValue = _T("ip_address");
pRecNode->attributes->setNamedItem(pRecIdAttr1);


But the above code works good in MSXML2 but i want to work in MSXML4
and so i am modifying code so that it works fine in MSXML4: which is as follows:

XMLDOMDocumentPtr pXMLDoc = NULL;
CoInitialize(NULL);
hr=pXMLDoc.CreateInstance("msxml2.domdocument");
IXMLDOMNodePtr pRootNode= NULL;
IXMLDOMNodePtr pRecNode= NULL;
_variant_t varNodeType((short)MSXML2::NODE_ELEMENT);
hr= pXMLDoc->createNode(varNodeType,
_T("RTCS"), _T("Remote Target Control System"),&pRootNode)

but the problem is with i am not able to attach child node Connection with Root node RTCS:
I am not able to get the code right for the above version to do this.

The problem is CreateElementdoesn't work same in both the versions,also attributes is also different.


Regards
AnswerRe: Code to create XML file Pin
led mike26-Jul-07 4:42
led mike26-Jul-07 4:42 
GeneralRe: Code to create XML file Pin
Maynka26-Jul-07 5:07
Maynka26-Jul-07 5:07 
QuestionWriteFile issue Pin
George_George26-Jul-07 3:03
George_George26-Jul-07 3:03 
AnswerRe: WriteFile issue Pin
David Crow26-Jul-07 3:11
David Crow26-Jul-07 3:11 
GeneralRe: WriteFile issue Pin
CPallini26-Jul-07 3:32
mveCPallini26-Jul-07 3:32 
QuestionRe: WriteFile issue Pin
David Crow26-Jul-07 3:44
David Crow26-Jul-07 3:44 
AnswerRe: WriteFile issue Pin
CPallini26-Jul-07 4:24
mveCPallini26-Jul-07 4:24 
AnswerRe: WriteFile issue [modified] Pin
CPallini26-Jul-07 3:27
mveCPallini26-Jul-07 3:27 
QuestionC and converting data types. Pin
choadvach26-Jul-07 2:53
choadvach26-Jul-07 2:53 
AnswerRe: C and converting data types. Pin
Chris Losinger26-Jul-07 3:00
professionalChris Losinger26-Jul-07 3:00 
AnswerRe: C and converting data types. Pin
jhwurmbach26-Jul-07 3:05
jhwurmbach26-Jul-07 3:05 
AnswerRe: C and converting data types. Pin
CPallini26-Jul-07 3:10
mveCPallini26-Jul-07 3:10 
GeneralRe: C and converting data types. Pin
choadvach26-Jul-07 3:52
choadvach26-Jul-07 3:52 
QuestionTransferring Data from a Dialog to a SDI View Pin
CrocodileBuck26-Jul-07 2:46
CrocodileBuck26-Jul-07 2:46 
AnswerRe: Transferring Data from a Dialog to a SDI View Pin
jhwurmbach26-Jul-07 3:12
jhwurmbach26-Jul-07 3:12 
GeneralRe: Transferring Data from a Dialog to a SDI View Pin
CrocodileBuck26-Jul-07 3:15
CrocodileBuck26-Jul-07 3:15 
GeneralRe: Transferring Data from a Dialog to a SDI View Pin
jhwurmbach26-Jul-07 3:36
jhwurmbach26-Jul-07 3:36 

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.