APIdia Launch Partner
Top Description Fields Constructors Methods
javax.xml.transform.dom

public Class DOMSource

extends Object
implements Source
Class Inheritance
All Implemented Interfaces
javax.xml.transform.Source
Imports
javax.xml.transform.Source, org.w3c.dom.Node

Acts as a holder for a transformation Source tree in the form of a Document Object Model (DOM) tree.

Note that XSLT requires namespace support. Attempting to transform a DOM that was not constructed with a namespace-aware parser may result in errors. Parsers can be made namespace aware by calling javax.xml.parsers.DocumentBuilderFactory#setNamespaceAware(boolean awareness).

Author
Jeff Suttor
Since
1.4
See Also
Document Object Model (DOM) Level 2 Specification

Field Summary

Modifier and TypeField and Description
public static final String
FEATURE

If javax.xml.transform.TransformerFactory#getFeature returns true when passed this value as an argument, the Transformer supports Source input of this type.

private Node
node

Node to serve as DOM source.

private String
systemID

The base ID (URL or system ID) from where URLs will be resolved.

Constructor Summary

AccessConstructor and Description
public
DOMSource()

Zero-argument default constructor.

public
DOMSource(Node
The DOM node that will contain the Source tree.
n
)

Create a new input source with a DOM node.

public
DOMSource(Node
The DOM node that will contain the Source tree.
node
,
String
Specifies the base URI associated with node.
systemID
)

Create a new input source with a DOM node, and with the system ID also passed in as the base URI.

Method Summary

Modifier and TypeMethod and Description
public Node

Returns:

The node that is to be transformed.
getNode
()

Get the node that represents a Source DOM tree.

public String

Returns:

Base URL for this DOM tree.
getSystemId
()

Implements javax.xml.transform.Source.getSystemId.

Get the base ID (URL or system ID) from where URLs will be resolved.

public boolean

Returns:

true if the DOMSource object is empty, false otherwise
isEmpty
()

Overrides default javax.xml.transform.Source.isEmpty.

Indicates whether the DOMSource object is empty.

public void
setNode(Node
The node that is to be transformed.
node
)

Set the node that will represents a Source DOM tree.

public void
setSystemId(String
Base URL for this DOM tree.
systemID
)

Implements javax.xml.transform.Source.setSystemId.

Set the base ID (URL or system ID) from where URLs will be resolved.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FEATUREback to summary
public static final String FEATURE

If javax.xml.transform.TransformerFactory#getFeature returns true when passed this value as an argument, the Transformer supports Source input of this type.

nodeback to summary
private Node node

Node to serve as DOM source.

systemIDback to summary
private String systemID

The base ID (URL or system ID) from where URLs will be resolved.

Constructor Detail

DOMSourceback to summary
public DOMSource()

Zero-argument default constructor. If this constructor is used, and no DOM source is set using setNode(Node node) , then the Transformer will create an empty source org.w3c.dom.Document using javax.xml.parsers.DocumentBuilder#newDocument().

See Also
javax.xml.transform.Transformer#transform(Source xmlSource, Result outputTarget)
DOMSourceback to summary
public DOMSource(Node n)

Create a new input source with a DOM node. The operation will be applied to the subtree rooted at this node. In XSLT, a "/" pattern still means the root of the tree (not the subtree), and the evaluation of global variables and parameters is done from the root node also.

Parameters
n:Node

The DOM node that will contain the Source tree.

DOMSourceback to summary
public DOMSource(Node node, String systemID)

Create a new input source with a DOM node, and with the system ID also passed in as the base URI.

Parameters
node:Node

The DOM node that will contain the Source tree.

systemID:String

Specifies the base URI associated with node.

Method Detail

getNodeback to summary
public Node getNode()

Get the node that represents a Source DOM tree.

Returns:Node

The node that is to be transformed.

getSystemIdback to summary
public String getSystemId()

Implements javax.xml.transform.Source.getSystemId.

Get the base ID (URL or system ID) from where URLs will be resolved.

Returns:String

Base URL for this DOM tree.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Overrides default javax.xml.transform.Source.isEmpty.

Indicates whether the DOMSource object is empty. Empty is defined as follows:

  • if the system identifier and node are null;
  • if the system identifier is null, and the node has no child nodes.
Returns:boolean

true if the DOMSource object is empty, false otherwise

Annotations
@Override
setNodeback to summary
public void setNode(Node node)

Set the node that will represents a Source DOM tree.

Parameters
node:Node

The node that is to be transformed.

setSystemIdback to summary
public void setSystemId(String systemID)

Implements javax.xml.transform.Source.setSystemId.

Set the base ID (URL or system ID) from where URLs will be resolved.

Parameters
systemID:String

Base URL for this DOM tree.

Annotations
@Override