Oracle® Application Server
XML Java API Reference
10g Release 3 (10.1.3)

B28238-01


oracle.xml.parser.v2
Class NodeFactory

java.lang.Object
  extended byoracle.xml.parser.v2.NodeFactory

All Implemented Interfaces:
java.io.Serializable

public class NodeFactory
extends java.lang.Object
implements java.io.Serializable

This class specifies methods to create various nodes of the DOM tree built during parsing. Applications can override these methods to create their own custom classes to be added to the DOM tree while parsing. Applications have to register their own NodeFactory using the DOMParser's setNodeFactory() method. If a null pointer is returned by these methods, then the node will not be added to the DOM tree.

See Also:
DOMParser.setNodeFactory(oracle.xml.parser.v2.NodeFactory), Serialized Form

Constructor Summary
NodeFactory()
Default constructor for NodeFactory
protected NodeFactory(XMLDocument doc)
Constructor for NodeFactory to setup Document context

Method Summary
XMLAttr createAttribute(java.lang.String tag, java.lang.String text)
Creates an attribute node with the specified tag, and text.
XMLAttr createAttributeNS(java.lang.String localName, java.lang.String prefix, java.lang.String namespaceURI, java.lang.String value)
Creates an attribute node with the specified tag, and text.
XMLCDATA createCDATASection(java.lang.String text)
Creates a CDATA node with the specified text.
XMLComment createComment(java.lang.String text)
Creates a comment node with the specified text.
XMLDocument createDocument()
Creates a document node.
XMLDocumentFragment createDocumentFragment()
Creates a document fragment node.
XMLElement createElement(java.lang.String tag)
Creates an Element node with the specified tag.
XMLElement createElementNS(java.lang.String localName, java.lang.String prefix, java.lang.String namespaceURI)
Creates an Element node with the specified local name,prefix , namespaceURI.
XMLEntityReference createEntityReference(java.lang.String tag)
Creates an entity reference node with the specified tag.
XMLPI createProcessingInstruction(java.lang.String tag, java.lang.String text)
Creates a PI node with the specified tag, and text.
XMLText createTextNode(java.lang.String text)
Creates a text node with the specified text.
boolean isNamespaceAware()
Check if the NodeFactory is namespace aware If TRUE, createElementNS(localName, prefix, namespaceURI) and createAttributeNS(localName, prefix, namespaceURI, value) functions will be used to create Element and Attr nodes.

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

NodeFactory

public NodeFactory()
Default constructor for NodeFactory

NodeFactory

protected NodeFactory(XMLDocument doc)
Constructor for NodeFactory to setup Document context
Parameters:
doc - - Document used to create node, if the function is not present in the subclass.

Method Detail

isNamespaceAware

public boolean isNamespaceAware()
Check if the NodeFactory is namespace aware If TRUE, createElementNS(localName, prefix, namespaceURI) and createAttributeNS(localName, prefix, namespaceURI, value) functions will be used to create Element and Attr nodes. The default is FALSE, to keep backward compatibilty. Subclasses must override this function and return 'true' to create namespace aware nodes.
Returns:
- boolean - namespace awareness

createDocument

public XMLDocument createDocument()
Creates a document node. This method cannot return a null pointer.
Returns:
The created document

createElement

public XMLElement createElement(java.lang.String tag)
Creates an Element node with the specified tag.
Parameters:
tag - The name of the element.
Returns:
The created element.

createElementNS

public XMLElement createElementNS(java.lang.String localName,
                                  java.lang.String prefix,
                                  java.lang.String namespaceURI)
Creates an Element node with the specified local name,prefix , namespaceURI.
Parameters:
localName - the name of the element
prefix - the prefix of the element,
namespaceURI - the namespace of the element
Returns:
The created element.

createTextNode

public XMLText createTextNode(java.lang.String text)
Creates a text node with the specified text.
Parameters:
text - The text associated with the node.
Returns:
The created text node.

createCDATASection

public XMLCDATA createCDATASection(java.lang.String text)
Creates a CDATA node with the specified text.
Parameters:
text - The text associated with the node.
Returns:
The created CDATA node.

createComment

public XMLComment createComment(java.lang.String text)
Creates a comment node with the specified text.
Parameters:
text - The text associated with the node.
Returns:
The created comment node.

createProcessingInstruction

public XMLPI createProcessingInstruction(java.lang.String tag,
                                         java.lang.String text)
Creates a PI node with the specified tag, and text.
Parameters:
tag - The name of the node.
text - The text associated with the node.
Returns:
The created PI node.

createAttribute

public XMLAttr createAttribute(java.lang.String tag,
                               java.lang.String text)
Creates an attribute node with the specified tag, and text.
Parameters:
tag - The name of the node.
text - The text associated with the node.
Returns:
The created attribute node.

createAttributeNS

public XMLAttr createAttributeNS(java.lang.String localName,
                                 java.lang.String prefix,
                                 java.lang.String namespaceURI,
                                 java.lang.String value)
Creates an attribute node with the specified tag, and text.
Parameters:
localName - the name of the node.
prefix - the prefix of the node.
namespaceURI - the namespace of the node
value - The value associated with the node.
Returns:
The created attribute node.

createDocumentFragment

public XMLDocumentFragment createDocumentFragment()
Creates a document fragment node.
Returns:
The created document fragment node.

createEntityReference

public XMLEntityReference createEntityReference(java.lang.String tag)
Creates an entity reference node with the specified tag.
Parameters:
tag - The name of the node.
Returns:
The created entity reference node.

Oracle® Application Server
XML Java API Reference
10g Release 3 (10.1.3)

B28238-01


Copyright © 2003, 2006, Oracle. All rights reserved.