oracle.xml.parser.v2
Class NodeFactory

java.lang.Object
  |
  +--oracle.xml.parser.v2.NodeFactory

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 XMLParser'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()
           
 
Method Summary
 XMLAttr createAttribute(java.lang.String tag, java.lang.String text)
          Creates an attribute node with the specified tag, and text.
 XMLAttr createAttribute(java.lang.String localName, java.lang.String prefix, java.lang.String namespaceURI, java.lang.String value)
          Deprecated. use createAttributeNS
 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 with the specified tag.
 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()
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

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:
The - local name of the element, prefix of the element, namespaceURI of the element
Returns:
The created element.

createDocument

public XMLDocument createDocument()
Creates a document node. This method cannot return a null pointer.
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.

createAttribute

public XMLAttr createAttribute(java.lang.String localName,
                               java.lang.String prefix,
                               java.lang.String namespaceURI,
                               java.lang.String value)
Deprecated. use createAttributeNS


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 with the specified tag.
Parameters:
tag - The name of the 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.


 

Copyright © 1997, 2004, Oracle. All rights reserved.