You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2006/11/21 19:41:14 UTC

svn commit: r477808 - /xerces/java/trunk/docs/faq-dom.xml

Author: mrglavas
Date: Tue Nov 21 10:41:14 2006
New Revision: 477808

URL: http://svn.apache.org/viewvc?view=rev&rev=477808
Log:
Clean up DOM examples. Setting the DOMImplementationRegistry.PROPERTY system
property is usually unnecessary. The DOMImplementationRegistry will find the
META-INF entry in xercesImpl.jar and the load the right DOMImplementationSource.
The Xerces serializer example is using a FileWriter which will write using
the platform's default encoding. Since this has the potential to create a
mismatch between the actual encoding of the document and encoding specified
in the encoding declaration in the document this is often the wrong thing to
be using. Changing the example to use a FileOutputStream instead.

Modified:
    xerces/java/trunk/docs/faq-dom.xml

Modified: xerces/java/trunk/docs/faq-dom.xml
URL: http://svn.apache.org/viewvc/xerces/java/trunk/docs/faq-dom.xml?view=diff&rev=477808&r1=477807&r2=477808
==============================================================================
--- xerces/java/trunk/docs/faq-dom.xml (original)
+++ xerces/java/trunk/docs/faq-dom.xml Tue Nov 21 10:41:14 2006
@@ -76,8 +76,6 @@
 
 ...
 
-System.setProperty(DOMImplementationRegistry.PROPERTY,
-    "org.apache.xerces.dom.DOMImplementationSourceImpl");
 DOMImplementationRegistry registry = 
     DOMImplementationRegistry.newInstance();
 
@@ -88,7 +86,7 @@
     DOMImplementationLS.MODE_SYNCHRONOUS, null);
 	
 Document document = builder.parseURI("data/personal.xml");</source>
-      <note>You can now use DOM Level 3 Load/Save and Core interfaces with the default Xerces distribution. 
+      <note>You can now use DOM Level 3 Load/Save and Core interfaces with the regular Xerces distribution. 
       </note>
     </a>
   </faq>
@@ -107,8 +105,6 @@
 
 ...
 
-System.setProperty(DOMImplementationRegistry.PROPERTY,
-    "org.apache.xerces.dom.DOMImplementationSourceImpl");
 DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
 
 DOMImplementationLS impl = 
@@ -139,7 +135,7 @@
 format.setLineWidth(0);             
 format.setPreserveSpace(true);
 XMLSerializer serializer = new XMLSerializer (
-    new FileWriter("output.xml"), format);
+    new FileOutputStream("output.xml"), format);
 serializer.asDOMSerializer();
 serializer.serialize(document);</source>
     </a>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org