Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Difference between transformNode and transformNodeToObject with respect to character encoding

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 1/6/2007 3:21:00 PM

Pramod Subramanyan wrote:

> outXMLString = inputDoc.transformNode(stylesheet)
> ' Code to write outXMLString to a file


Well you have not shown us the essential code at all, the stylesheet (in 
particular its xsl:output element that might specify an output encoding) 
and of course the "Code to write outXMLString to a file". In terms of 
Unicode characters 'µ' is _one character_ and how many _bytes_ you need 
to encode this in a stream/file depends on the encoding choosen, UTF-8 
encodes the character with two bytes, ISO-8859-1 encodes the character 
with one byte.

Generally with MSXML and XSLT if you want to transform to a file then it 
is best to use transformNodeToObject to transform to a stream like 
ADODB.Stream as that way MSXML makes sure to properly encode the output. 
Or you can, as you have done, first transform to another DOMDocument and 
save that with its save method.

If you use transformNode to transform to a string then you have a 
sequence of Unicode characters as the result and your own code is then 
responsible to properly write that to a file, taking into account the 
encoding in the XML declaration.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent