abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1372161 - /abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
Date Sun, 12 Aug 2012 17:50:15 GMT
Author: veithen
Date: Sun Aug 12 17:50:15 2012
New Revision: 1372161

URL: http://svn.apache.org/viewvc?rev=1372161&view=rev
Log:
No need to replace the entire StAXOMBuilder#next() method. At this point we only need to override
the method to transform exceptions.

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

Modified: abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java?rev=1372161&r1=1372160&r2=1372161&view=diff
==============================================================================
--- abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java (original)
+++ abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java Sun
Aug 12 17:50:15 2012
@@ -20,7 +20,6 @@ package org.apache.abdera.parser.stax;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.abdera.filter.ParseFilter;
@@ -124,53 +123,9 @@ public class FOMBuilder extends StAXOMBu
      */
     public int next() throws OMException {
         try {
-            if (done) {
-                throw new OMException();
-            }
-            int token = parser.next();
-            if (!cache) {
-                return token;
-            }
-            switch (token) {
-                case XMLStreamConstants.START_ELEMENT:
-                    lastNode = createOMElement();
-                    break;
-                case XMLStreamConstants.START_DOCUMENT:
-                    document.setXMLVersion(parser.getVersion() != null ? parser.getVersion()
: "1.0");
-                    document.setCharsetEncoding(parser.getEncoding() != null ? parser.getEncoding()
: "utf-8");
-                    document.setStandalone(parser.isStandalone() ? YES : NO);
-                    break;
-                case XMLStreamConstants.CHARACTERS:
-                    lastNode = createOMText(XMLStreamConstants.CHARACTERS);
-                    break;
-                case XMLStreamConstants.CDATA:
-                    lastNode = createOMText(XMLStreamConstants.CDATA);
-                    break;
-                case XMLStreamConstants.END_ELEMENT:
-                    endElement();
-                    break;
-                case XMLStreamConstants.END_DOCUMENT:
-                    done = true;
-                    ((OMContainerEx)this.document).setComplete(true);
-                    break;
-                case XMLStreamConstants.SPACE:
-                    lastNode = createOMText(XMLStreamConstants.SPACE);
-                    break;
-                case XMLStreamConstants.COMMENT:
-                    createComment();
-                    break;
-                case XMLStreamConstants.PROCESSING_INSTRUCTION:
-                    createPI();
-                    break;
-                default:
-                    throw new ParseException();
-            }
-            return token;
-        } catch (ParseException e) {
-            throw e;
+            return super.next();
         } catch (OMException e) {
-            throw new ParseException(e);
-        } catch (Exception e) {
+            // TODO: transforming the OMException here is not ideal!
             throw new ParseException(e);
         }
     }



Mime
View raw message