Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: Mon, 16 Jun 2008 14:49:52 +0800,    group: microsoft.public.xml        back       


write bool in element node   
Hi there,

In C++, I use following code to output bool:

     MSXML2::IXMLDOMNodePtr pNode = pXMLDoc->createElement(_T("TestNode"));
     pNode->put_text(CString(_variant_t(false)));

When saving, it output:
<TestNode>0</TestNode>

But I want:
<TestNode>false</TestNode>

Should I use "pNode->put_text(_T(false))" directly? Or are there any  
method to write bool value to true/false string directly?

Thanks much.
Layman
date: Mon, 16 Jun 2008 14:49:52 +0800   author:   Layman

Re: write bool in element node   
* Layman wrote in microsoft.public.xml:
>In C++, I use following code to output bool:
>
>     MSXML2::IXMLDOMNodePtr pNode = pXMLDoc->createElement(_T("TestNode"));
>     pNode->put_text(CString(_variant_t(false)));
>
>When saving, it output:
><TestNode>0</TestNode>
>
>But I want:
><TestNode>false</TestNode>
>
>Should I use "pNode->put_text(_T(false))" directly? Or are there any  
>method to write bool value to true/false string directly?

There may be other COM/ATL/MFC constructs to achieve the conversion from
the false boolean to the string "false", but there is no MSXML-specific
one (assuming MSXML does not support passing the VARIANT_FALSE directly)
so passing the string literal should be the way to go.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
date: Mon, 16 Jun 2008 09:15:39 +0200   author:   Bjoern Hoehrmann

Re: write bool in element node   
"Bjoern Hoehrmann"  wrote in message 
news:di4c541easa9grtfu7amccrf623l1kfub0@hive.bjoern.hoehrmann.de...
>* Layman wrote in microsoft.public.xml:
>>In C++, I use following code to output bool:
>>
>>     MSXML2::IXMLDOMNodePtr pNode = 
>> pXMLDoc->createElement(_T("TestNode"));
>>     pNode->put_text(CString(_variant_t(false)));
>>
>>When saving, it output:
>><TestNode>0</TestNode>
>>
>>But I want:
>><TestNode>false</TestNode>
>>
>>Should I use "pNode->put_text(_T(false))" directly? Or are there any
>>method to write bool value to true/false string directly?
>
> There may be other COM/ATL/MFC constructs to achieve the conversion from
> the false boolean to the string "false", but there is no MSXML-specific
> one (assuming MSXML does not support passing the VARIANT_FALSE directly)
> so passing the string literal should be the way to go.
> -- 
> Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
> Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
> 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/


I am interested in this also, but I assume the answer is in the 
documentation; I have not looked yet.

I am hoping there is an if statement that allows us to generate either "yes" 
or "no":
date: Sun, 15 Jun 2008 22:52:28 -0700   author:   Sam Hobbs _change_social_to_socal

Re: write bool in element node   
On Mon, 16 Jun 2008 15:15:39 +0800, Bjoern Hoehrmann   
wrote:

> * Layman wrote in microsoft.public.xml:
>> In C++, I use following code to output bool:
>>
>>     MSXML2::IXMLDOMNodePtr pNode =  
>> pXMLDoc->createElement(_T("TestNode"));
>>     pNode->put_text(CString(_variant_t(false)));
>>
>> When saving, it output:
>> <TestNode>0</TestNode>
>>
>> But I want:
>> <TestNode>false</TestNode>
>>
>> Should I use "pNode->put_text(_T(false))" directly? Or are there any
>> method to write bool value to true/false string directly?
>
> There may be other COM/ATL/MFC constructs to achieve the conversion from
> the false boolean to the string "false", but there is no MSXML-specific
> one (assuming MSXML does not support passing the VARIANT_FALSE directly)
> so passing the string literal should be the way to go.


Thanks a lot. It seems that I should write such a utility function by  
myself.
date: Tue, 17 Jun 2008 14:38:14 +0800   author:   Layman

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us