BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.apache.xpath
Class SourceTreeManager

java.lang.Object
  |
  +--weblogic.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 (not yet!), and should centralize parsing for those source trees.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.


Constructor Summary
SourceTreeManager()
           
 
Method Summary
 java.lang.String findURIFromDoc(org.w3c.dom.Document owner)
          Given a document, find the URL associated with that document.
 org.w3c.dom.Node getDOMNode(javax.xml.transform.Source source, javax.xml.transform.SourceLocator locator)
          Try to create a DOM source tree from the input source.
 org.w3c.dom.Node getNode(javax.xml.transform.Source source)
          Given a Source object, find the node associated with it.
 org.w3c.dom.Node getSourceTree(javax.xml.transform.Source source, javax.xml.transform.SourceLocator locator)
          Get the source tree from the input source.
 org.w3c.dom.Node getSourceTree(java.lang.String base, java.lang.String urlString, javax.xml.transform.SourceLocator locator)
          Get the source tree from the a base URL and a URL string.
 javax.xml.transform.URIResolver getURIResolver()
          Get the object that will be used to resolve URIs used in document(), etc.
 org.xml.sax.XMLReader getXMLReader(javax.xml.transform.Source inputSource, javax.xml.transform.SourceLocator locator)
          This method returns the SAX2 parser to use with the InputSource obtained from this URI.
 void putDocumentInCache(org.w3c.dom.Node n, javax.xml.transform.Source source)
          Put the source tree root node in the document cache.
 void reset()
          Reset the list of SourceTree objects that this manager manages.
 javax.xml.transform.Source resolveURI(java.lang.String base, java.lang.String urlString, javax.xml.transform.SourceLocator locator)
          This will be called by the processor when it encounters an xsl:include, xsl:import, or document() function.
 void setURIResolver(javax.xml.transform.URIResolver resolver)
          Set an object that will be used to resolve URIs used in document(), etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceTreeManager

public SourceTreeManager()
Method Detail

reset

public void reset()
Reset the list of SourceTree objects that this manager manages.

setURIResolver

public void setURIResolver(javax.xml.transform.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.

getURIResolver

public javax.xml.transform.URIResolver getURIResolver()
Get the object that will be used to resolve URIs used in document(), etc.

Returns:
An object that implements the URIResolver interface, or null.

findURIFromDoc

public java.lang.String findURIFromDoc(org.w3c.dom.Document owner)
Given a document, find the URL associated with that document.

Parameters:
owner - Document that was previously processed by this liaison.
Returns:
The base URI of the owner argument.

resolveURI

public javax.xml.transform.Source resolveURI(java.lang.String base,
                                             java.lang.String urlString,
                                             javax.xml.transform.SourceLocator locator)
                                      throws javax.xml.transform.TransformerException,
                                             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.
urlString - Value from an xsl:import or xsl:include's href attribute, or a URI specified in the document() function.
Returns:
a Source that can be used to process the resource.
Throws:
java.io.IOException -  
javax.xml.transform.TransformerException -  

putDocumentInCache

public void putDocumentInCache(org.w3c.dom.Node n,
                               javax.xml.transform.Source source)
Put the source tree root node in the document cache. TODO: This function needs to be a LOT more sophisticated.

Parameters:
n - The node to cache.
source - The Source object to cache.

getNode

public org.w3c.dom.Node getNode(javax.xml.transform.Source source)
Given a Source object, find the node associated with it.

Parameters:
source - The Source object to act as the key.
Returns:
The node that is associated with the Source, or null if not found.

getSourceTree

public org.w3c.dom.Node getSourceTree(java.lang.String base,
                                      java.lang.String urlString,
                                      javax.xml.transform.SourceLocator locator)
                               throws javax.xml.transform.TransformerException
Get the source tree from the a base URL and a URL string.

Parameters:
base - The base URI to use if the urlString is relative.
urlString - An absolute or relative URL string.
locator - The location of the caller, for diagnostic purposes.
Returns:
should be a non-null reference to the node identified by the base and urlString.
Throws:
javax.xml.transform.TransformerException - If the URL can not resolve to a node.

getSourceTree

public org.w3c.dom.Node getSourceTree(javax.xml.transform.Source source,
                                      javax.xml.transform.SourceLocator locator)
                               throws javax.xml.transform.TransformerException
Get the source tree from the input source.

Parameters:
source - The Source object that should identify the desired node.
locator - The location of the caller, for diagnostic purposes.
Returns:
non-null reference to a node.
Throws:
javax.xml.transform.TransformerException - if the Source argument can't be resolved to a node.

getDOMNode

public org.w3c.dom.Node getDOMNode(javax.xml.transform.Source source,
                                   javax.xml.transform.SourceLocator locator)
                            throws javax.xml.transform.TransformerException
Try to create a DOM source tree from the input source.

Parameters:
source - The Source object that identifies the source node.
locator - The location of the caller, for diagnostic purposes.
Returns:
non-null reference to node identified by the source argument.
Throws:
javax.xml.transform.TransformerException - if the source argument can not be resolved to a source node.

getXMLReader

public org.xml.sax.XMLReader getXMLReader(javax.xml.transform.Source inputSource,
                                          javax.xml.transform.SourceLocator locator)
                                   throws javax.xml.transform.TransformerException
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 URIResolver.
locator - The location of the original caller, for diagnostic purposes.
Returns:
non-null XMLReader reference ready to parse.
Throws:
javax.xml.transform.TransformerException - if the reader can not be created.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.