net.sf.xaj.core
Class DOMXmlResource

java.lang.Object
  extended by net.sf.xaj.core.DOMXmlResource
All Implemented Interfaces:
XmlResource

public class DOMXmlResource
extends java.lang.Object
implements XmlResource

A DOM Document based XmlResource implementation.

Note that the getAsStream() method uses a PipedInputStream connected to a PipedOutputStream that generates the stream in a newly created thread. In addition the getAsString() method internally calls the getAsStream() method.

Version:
$Revision$ $Date$
Author:
matt

Constructor Summary
DOMXmlResource(org.w3c.dom.Node node, java.io.Serializable id)
          Construct from a DOM Node and ID.
 
Method Summary
 void free()
          Free up any resources associated with this XmlResource.
 javax.xml.transform.Source getAsSource()
          Get the content of this XML resource as an XSLT Source, for use in a transformation.
 java.io.InputStream getAsStream()
          Get the content of this XML resource as an input stream
 java.lang.String getAsString()
          Get the content of this XML resource as a String.
 java.io.Serializable getId()
          Get the unique ID that identifies this XML resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMXmlResource

public DOMXmlResource(org.w3c.dom.Node node,
                      java.io.Serializable id)
Construct from a DOM Node and ID.

Parameters:
node - a DOM node
id - the ID
Method Detail

free

public void free()
Description copied from interface: XmlResource
Free up any resources associated with this XmlResource.

After calling this method the XmlResource instance should not be used anymore.

Specified by:
free in interface XmlResource

getAsSource

public javax.xml.transform.Source getAsSource()
Description copied from interface: XmlResource
Get the content of this XML resource as an XSLT Source, for use in a transformation.

Specified by:
getAsSource in interface XmlResource
Returns:
XSLT Source

getAsStream

public java.io.InputStream getAsStream()
Description copied from interface: XmlResource
Get the content of this XML resource as an input stream

Specified by:
getAsStream in interface XmlResource
Returns:
the content of this resource

getAsString

public java.lang.String getAsString()
Description copied from interface: XmlResource
Get the content of this XML resource as a String.

Specified by:
getAsString in interface XmlResource
Returns:
the content of this resource as a String

getId

public java.io.Serializable getId()
Description copied from interface: XmlResource
Get the unique ID that identifies this XML resource.

This is the "primary key" for the XML resource. Note that this will only be available for complete XML documents, not necessarily for results returned by XQuery evaluation since that might return arbitrary nodes.

Specified by:
getId in interface XmlResource
Returns:
the ID