org.apache.xpath
Class SourceTreeManager

java.lang.Object
  |
  +--org.apache.xpath.SourceTreeManager

public class SourceTreeManager
extends java.lang.Object

This class bottlenecks all management of source trees. The methods in this class should allow easy garbage collection of source trees, and should centralize parsing for those source trees.


Constructor Summary
SourceTreeManager()
           
 
Method Summary
 Node findNodeFromURL(java.lang.String base, java.lang.String url, Locator locator)
          Given a URL, find the node associated with that document.
 java.lang.String findURIFromDoc(Document owner)
          Given a document, find the URL associated with that document.
 Node getDOMNode(InputSource source, Locator locator)
          Try to create a DOM source tree from the input source.
 Node getSourceTree(InputSource source, Locator locator)
          Get the source tree from the input source.
 Node getSourceTree(java.lang.String base, java.lang.String urlString, Locator locator)
          Get the source tree from the a base URL and a URL string.
 XMLReader getXMLReader(InputSource inputSource, Locator locator)
          This method returns the SAX2 parser to use with the InputSource obtained from this URI.
 void putDocumentInCache(Node n, InputSource source)
          Put the source tree root node in the document cache.
 InputSource resolveURI(java.lang.String base, java.lang.String urlString, Locator locator)
          This will be called by the processor when it encounters an xsl:include, xsl:import, or document() function.
 void setEntityResolver(EntityResolver resolver)
           
 void setURIResolver(URIResolver resolver)
          Set an object that will be used to resolve URIs used in document(), etc.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceTreeManager

public SourceTreeManager()
Method Detail

setURIResolver

public void setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in document(), etc.
Parameters:
resolver - An object that implements the URIResolver interface, or null.

setEntityResolver

public void setEntityResolver(EntityResolver resolver)

findURIFromDoc

public java.lang.String findURIFromDoc(Document owner)
Given a document, find the URL associated with that document.
Parameters:
owner - Document that was previously processed by this liaison.

resolveURI

public InputSource resolveURI(java.lang.String base,
                              java.lang.String urlString,
                              Locator locator)
                       throws TransformException,
                              java.io.IOException
This will be called by the processor when it encounters an xsl:include, xsl:import, or document() function.
Parameters:
base - The base URI that should be used.
uri - Value from an xsl:import or xsl:include's href attribute, or a URI specified in the document() function.

putDocumentInCache

public void putDocumentInCache(Node n,
                               InputSource source)
Put the source tree root node in the document cache. TODO: This function needs to be a LOT more sophisticated.

findNodeFromURL

public Node findNodeFromURL(java.lang.String base,
                            java.lang.String url,
                            Locator locator)
                     throws TransformException
Given a URL, find the node associated with that document.
Parameters:
url -  

getSourceTree

public Node getSourceTree(java.lang.String base,
                          java.lang.String urlString,
                          Locator locator)
                   throws TransformException
Get the source tree from the a base URL and a URL string.

getSourceTree

public Node getSourceTree(InputSource source,
                          Locator locator)
                   throws TransformException
Get the source tree from the input source.

getDOMNode

public Node getDOMNode(InputSource source,
                       Locator locator)
                throws TransformException
Try to create a DOM source tree from the input source.

getXMLReader

public XMLReader getXMLReader(InputSource inputSource,
                              Locator locator)
                       throws TransformException
This method returns the SAX2 parser to use with the InputSource obtained from this URI. It may return null if any SAX2-conformant XML parser can be used, or if getInputSource() will also return null. The parser must be free for use (i.e. not currently in use for another parse().
Parameters:
inputSource - The value returned from the EntityResolver.


Copyright © 2000 Apache XML Project. All Rights Reserved.