abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r493112 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
Date Fri, 05 Jan 2007 18:12:15 GMT
Author: jmsnell
Date: Fri Jan  5 10:12:14 2007
New Revision: 493112

URL: http://svn.apache.org/viewvc?view=rev&rev=493112
Log:
Cleanup on parsed document initialization.  Not all stax implementation allow accessing the
doc charset 
and xml version properties after the first start element event has occured. we need to init
the parsed doc
earlier.

Modified:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java?view=diff&rev=493112&r1=493111&r2=493112
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
Fri Jan  5 10:12:14 2007
@@ -63,6 +63,11 @@
       this.document = (OMDocument) factory.newDocument();
       this.parserOptions = parserOptions;
       this.fomfactory = factory;
+      String enc = parser.getCharacterEncodingScheme();
+      document.setCharsetEncoding(enc != null ? enc : "utf-8");
+      document.setXMLVersion(
+        parser.getVersion() != null ? 
+          parser.getVersion() : "1.0");
       if (parserOptions != null) {
         ParseFilter parseFilter = parserOptions.getParseFilter();
         if (parseFilter != null) {
@@ -245,19 +250,10 @@
     }
   }
   
-  private void initDocument(String name) {
-    fomDocument = (Document) document;
-    String enc = parser.getCharacterEncodingScheme();
-    getDocument().setCharsetEncoding(enc != null ? enc : "utf-8");
-    getDocument().setXMLVersion(
-      parser.getVersion() != null ? 
-        parser.getVersion() : "1.0");
-  }
-  
   protected OMElement constructNode(OMContainer parent, String name) {
     OMElement element = null;
     if (fomDocument == null) {
-      initDocument(name);
+      fomDocument = (Document) document;
       parent = (OMContainer) fomDocument;
     }
     QName qname = parser.getName();



Mime
View raw message