[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-cvs
Subject: svn commit: rev 20162 - xml/xerces-p/trunk
From: jasons () apache ! org
Date: 2004-05-20 16:41:47
Message-ID: 20040520164147.263.qmail () minotaur ! apache ! org
[Download RAW message or body]
Author: jasons
Date: Thu May 20 09:41:46 2004
New Revision: 20162
Modified:
xml/xerces-p/trunk/FAQ
Log:
added info about writeToString()
Modified: xml/xerces-p/trunk/FAQ
==============================================================================
--- xml/xerces-p/trunk/FAQ (original)
+++ xml/xerces-p/trunk/FAQ Thu May 20 09:41:46 2004
@@ -56,3 +56,22 @@
export LC_CTYPE=en_US
- Otherwise, are you using Perl-5.6.0 or greater?
+
+D. Serializing a DOM tree
+=========================
+D.1 Why does DOMWriter::writeToString() always output UTF-16 as the encoding?
+
+ Short answer: don't use writeToString().
+
+ Use a MemBufFormatTarget instead:
+
+ my $dom = XML::Xerces::XercesDOMParser->new();
+ eval{$dom->parse(XML::Xerces::MemBufInputSource->new($document))};
+ XML::Xerces::error($@) if $@;
+ my $doc = $dom->getDocument();
+
+ my $impl = XML::Xerces::DOMImplementationRegistry::getDOMImplementation('LS');
+ my $writer = $impl->createDOMWriter();
+ my $target = XML::Xerces::MemBufFormatTarget->new();
+ $writer->writeNode($target,$doc);
+
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic