You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2004/05/20 18:41:47 UTC

svn commit: rev 20162 - xml/xerces-p/trunk

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