You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2005/08/29 09:50:04 UTC

svn commit: r264097 - in /webservices/axis/trunk/java/modules: samples/resources/om/binary/binary.xml xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java

Author: chinthaka
Date: Mon Aug 29 00:49:47 2005
New Revision: 264097

URL: http://svn.apache.org/viewcvs?rev=264097&view=rev
Log:
Adding convenience methods to StAXOMBuilder

Modified:
    webservices/axis/trunk/java/modules/samples/resources/om/binary/binary.xml
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java

Modified: webservices/axis/trunk/java/modules/samples/resources/om/binary/binary.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/resources/om/binary/binary.xml?rev=264097&r1=264096&r2=264097&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/resources/om/binary/binary.xml (original)
+++ webservices/axis/trunk/java/modules/samples/resources/om/binary/binary.xml Mon Aug 29 00:49:47 2005
@@ -1 +1,15 @@
-<Project xmlns:apache="http://ws.apache.org/axis2"><Name>Axis2</Name><CurrentVersion>0.9</CurrentVersion><Modules><!-- List of modules that can be found under Axis2 project --><Module name="xml"><Description>XML Object Model</Description></Module><Module name="wsdl"><Description>Full WSDL solution for Axis2</Description></Module><Module name="core"><Description>Core parts of Axis2</Description></Module></Modules></Project>
\ No newline at end of file
+<Project xmlns:apache="http://ws.apache.org/axis2">
+    <Name>Axis2</Name>
+    <CurrentVersion>0.9</CurrentVersion>
+    <Modules><!-- List of modules that can be found under Axis2 project -->
+        <Module name="xml">
+            <Description>XML Object Model</Description>
+        </Module>
+        <Module name="wsdl">
+            <Description>Full WSDL solution for Axis2</Description>
+        </Module>
+        <Module name="core">
+            <Description>Core parts of Axis2</Description>
+        </Module>
+    </Modules>
+</Project>
\ No newline at end of file

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java?rev=264097&r1=264096&r2=264097&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java Mon Aug 29 00:49:47 2005
@@ -18,8 +18,13 @@
 import org.apache.axis2.om.*;
 import org.apache.axis2.om.impl.llom.OMDocumentImpl;
 
+import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
 
 
 /**
@@ -43,6 +48,25 @@
     public StAXOMBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) {
         super(ombuilderFactory, parser);
         document = new OMDocumentImpl(this);
+    }
+
+    /**
+     *
+     * @param filePath - Path to the XML file
+     * @throws XMLStreamException
+     * @throws FileNotFoundException
+     */
+    public StAXOMBuilder(String filePath) throws XMLStreamException, FileNotFoundException {
+       this(XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(filePath)));
+    }
+
+    /**
+     *
+     * @param inStream - instream which contains the XML
+     * @throws XMLStreamException
+     */
+    public StAXOMBuilder(InputStream inStream) throws XMLStreamException {
+       this(XMLInputFactory.newInstance().createXMLStreamReader(inStream));
     }
 
     /**