You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/08/04 21:37:07 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/templates FuncDocument.java
sboag 00/08/04 12:37:07
Modified: java/src/org/apache/xalan/templates FuncDocument.java
Log:
Make to work with new source tree manager stuff.
Revision Changes Path
1.5 +29 -38 xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java
Index: FuncDocument.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FuncDocument.java 2000/07/31 19:56:05 1.4
+++ FuncDocument.java 2000/08/04 19:37:06 1.5
@@ -140,7 +140,7 @@
else
base = xctxt.getSourceTreeManager().findURIFromDoc(baseDoc);
}
- else
+ else
{
base = arg2.str();
}
@@ -210,48 +210,39 @@
Node getDoc(XPathContext xctxt, Node context, String uri, String base)
throws org.xml.sax.SAXException
{
+ // System.out.println("base: "+base+", uri: "+uri);
SourceTreeManager treeMgr = xctxt.getSourceTreeManager();
Node newDoc = treeMgr.findNodeFromURL(uri);
- if(null == newDoc)
+ if(null != newDoc)
+ return newDoc;
+
+ // If the uri length is zero, get the uri of the stylesheet.
+ if(uri.length() == 0)
+ uri = xctxt.getNamespaceContext().getBaseIdentifier();
+
+ try
{
- if(uri.length() == 0)
+ if((null != uri) && (uri.toString().length() > 0))
{
- uri = xctxt.getNamespaceContext().getBaseIdentifier();
- }
- // TransformerImpl transformer = (TransformerImpl)xctxt;
- TransformerImpl transformer = (TransformerImpl)xctxt.getOwnerObject();
-
- {
- String url = null;
- try
- {
- url = xctxt.getAbsoluteURI(uri, base);
- if((null != url) && (url.toString().length() > 0))
- {
- InputSource inputSource = new InputSource(url);
- // System.out.println("Trying to parse: "+url.toString());
- newDoc = transformer.parseToNode(inputSource);
- }
- else
- {
- warn(xctxt, XSLTErrorResources.WG_CANNOT_MAKE_URL_FROM, new Object[]{((base == null) ? "" : base )+uri}); //"Can not make URL from: "+((base == null) ? "" : base )+uri);
- }
- }
- catch(Exception e)
- {
- newDoc = null;
- // path.warn(XSLTErrorResources.WG_ENCODING_NOT_SUPPORTED_USING_JAVA, new Object[]{((base == null) ? "" : base )+uri}); //"Can not load requested doc: "+((base == null) ? "" : base )+uri);
- }
- if(null == newDoc)
- {
- warn(xctxt, XSLTErrorResources.WG_CANNOT_LOAD_REQUESTED_DOC, new Object[]{url== null ?((base == null) ? "" : base)+uri : url.toString()}); //"Can not load requested doc: "+((base == null) ? "" : base )+uri);
- }
- else
- {
- // TBD: What to do about XLocator?
- // xctxt.getSourceTreeManager().associateXLocatorToNode(newDoc, url, null);
- }
+ newDoc = treeMgr.getSourceTree(base, uri);
+ // System.out.println("newDoc: "+((Document)newDoc).getDocumentElement().getNodeName());
}
+ else
+ warn(xctxt, XSLTErrorResources.WG_CANNOT_MAKE_URL_FROM, new Object[]{((base == null) ? "" : base )+uri}); //"Can not make URL from: "+((base == null) ? "" : base )+uri);
+ }
+ catch(Exception e)
+ {
+ newDoc = null;
+ // path.warn(XSLTErrorResources.WG_ENCODING_NOT_SUPPORTED_USING_JAVA, new Object[]{((base == null) ? "" : base )+uri}); //"Can not load requested doc: "+((base == null) ? "" : base )+uri);
+ }
+ if(null == newDoc)
+ {
+ warn(xctxt, XSLTErrorResources.WG_CANNOT_LOAD_REQUESTED_DOC, new Object[]{uri== null ?((base == null) ? "" : base)+uri : uri.toString()}); //"Can not load requested doc: "+((base == null) ? "" : base )+uri);
+ }
+ else
+ {
+ // TBD: What to do about XLocator?
+ // xctxt.getSourceTreeManager().associateXLocatorToNode(newDoc, url, null);
}
return newDoc;
}