abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r422830 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
Date Mon, 17 Jul 2006 20:17:22 GMT
Author: jmsnell
Date: Mon Jul 17 13:17:21 2006
New Revision: 422830

URL: http://svn.apache.org/viewvc?rev=422830&view=rev
Log:
Removing one level of indirection in the parse input stream option

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

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java?rev=422830&r1=422829&r2=422830&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
Mon Jul 17 13:17:21 2006
@@ -18,7 +18,6 @@
 package org.apache.abdera.parser.stax;
 
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.URI;
 
@@ -33,7 +32,6 @@
 import org.apache.abdera.parser.ParserOptions;
 import org.apache.abdera.parser.stax.util.FOMSniffingInputStream;
 import org.apache.abdera.util.AbstractParser;
-//import org.apache.abdera.util.SniffingInputStream;
 import org.apache.axiom.om.OMDocument;
 
 public class FOMParser 
@@ -86,14 +84,13 @@
         charset = sin.getEncoding();
         in = sin;
       }
-      Reader isr = null;
-      if (charset == null) {
-        isr = new InputStreamReader(in);
-      } else {
-        isr = new InputStreamReader(in,charset);
-      }
+      XMLStreamReader xmlreader = 
+        XMLInputFactory.newInstance().createXMLStreamReader(in);
       if (options != null && charset != null) options.setCharset(charset);
-      document = parse(isr, base, options);
+      FOMFactory factory = getFomFactory(options);
+      FOMBuilder builder = new FOMBuilder(factory, xmlreader, options);
+      document = getDocument(builder, base);
+      setCharset(options, xmlreader.getCharacterEncodingScheme(), document);
     } catch (Exception e) {
       if (!(e instanceof ParseException))
         e = new ParseException(e);



Mime
View raw message