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 di...@apache.org on 2005/07/10 01:26:52 UTC

svn commit: r209970 - /webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java

Author: dims
Date: Sat Jul  9 16:26:51 2005
New Revision: 209970

URL: http://svn.apache.org/viewcvs?rev=209970&view=rev
Log:
get getDocument to work for files specified using path relative to current directory

Modified:
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java?rev=209970&r1=209969&r2=209970&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/xpath/DocumentNavigator.java Sat Jul  9 16:26:51 2005
@@ -21,6 +21,7 @@
 import javax.xml.stream.XMLStreamReader;
 import java.net.URL;
 import java.util.Iterator;
+import java.io.FileInputStream;
 
 public class DocumentNavigator extends DefaultNavigator {
     /**
@@ -464,10 +465,15 @@
     public Object getDocument(String uri)
             throws FunctionCallException {
         try {
-            URL url = new URL(uri);
-            XMLStreamReader parser =
-                    XMLInputFactory.newInstance().createXMLStreamReader(
-                            url.openStream());
+            XMLStreamReader parser;
+            if(uri.indexOf(':')==-1) {
+                parser = XMLInputFactory.newInstance().createXMLStreamReader(
+                        new FileInputStream(uri));
+            }  else {
+                URL url = new URL(uri);
+                parser = XMLInputFactory.newInstance().createXMLStreamReader(
+                        url.openStream());
+            }
             StAXOMBuilder builder =
                     new StAXOMBuilder(parser);
             return builder.getDocumentElement();