com.plumtree.openfoundation.xml.dom
Class XPDocument

java.lang.Object
  extended by com.plumtree.openfoundation.xml.dom.XPNode
      extended by com.plumtree.openfoundation.xml.dom.XPDocument

public class XPDocument
extends XPNode

The XPDocument class is a wrapper for objects implementing org.w3c.dom.Document interface. Please refer to Node (Java 2 Platform SE v1.4.2) for detail information.

Author:
djc

Field Summary
 
Fields inherited from class com.plumtree.openfoundation.xml.dom.XPNode
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
XPDocument()
          Creates a new XPDocument object.
XPDocument(org.w3c.dom.Document currDoc)
          Creates a new XPDocument object.
 
Method Summary
 XPAttr CreateAttribute(java.lang.String name)
          Creates an XPAttr of the given name.
 XPAttr CreateAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Creates an attribute of the given qualified name and namespace URI.
 XPComment CreateComment(java.lang.String data)
          Creates a XPComment node given the specified string.
 XPCDATASection CreateDataSection(java.lang.String data)
          Creates a XPCDATASection node whose value is the specified string.
 XPDocumentFragment CreateDocumentFragment()
          Creates an empty XPDocumentFragment object.
 XPElement CreateElement(java.lang.String tagName)
          Creates an element of the type specified.
 XPElement CreateElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Creates an element of the given qualified name and namespace URI.
 XPProcessingInstruction CreateProcessingInstruction(java.lang.String target, java.lang.String data)
          Creates a XPProcessingInstruction node given the specified name and data strings.
 XPText CreateTextNode(java.lang.String value)
          Creates a XPText node given the specified string.
 XPDocumentType GetDocType()
          The Document Type Declaration (see XPDocumentType) associated with this document.
 XPElement GetDocumentElement()
          This is a convenience attribute that allows direct access to the child node that is the root element of the document.
 XPElement GetElementByID(java.lang.String elementID)
          Returns the XPElement whose ID is given by elementId.
 XPNodeList GetElementsByTagName(java.lang.String tagName)
          Returns a XPNodeList of all the XPElements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the XPDocument tree.
 XPNodeList GetElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
          Returns a XPNodeList of all the XPElements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the XPDocument tree.
 java.lang.String GetEncoding()
          Return this XPDocument's encoding string.
 org.w3c.dom.Node GetUnderlyingObject()
          Retrieve the underlying Node object.
 XPNode ImportNode(XPNode importedNode, boolean deep)
          Imports a node from another document to this document.
 void SetEncoding(java.lang.String encoding)
          Set the encoding of this XPDocument (part of XML Declaration).
 
Methods inherited from class com.plumtree.openfoundation.xml.dom.XPNode
AppendChild, CloneNode, GetAttributes, GetChildNodes, GetFirstChild, GetLastChild, GetLocalName, GetNamespaceURI, GetNextSibling, GetNodeName, GetNodeType, GetNodeValue, GetOwnerDocument, GetParentNode, GetPrefix, GetPreviousSibling, HasAttributes, HasChildNodes, InsertBefore, IsAttributeNode, IsCDATASectionNode, IsCommentNode, IsDocumentFragmentNode, IsDocumentNode, IsDocumentTypeNode, IsElementNode, IsProcessingInstructionNode, IsSupported, IsTextNode, Normalize, RemoveChild, ReplaceChild, SetNodeValue, SetPrefix, StoreNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPDocument

public XPDocument()
Creates a new XPDocument object.


XPDocument

public XPDocument(org.w3c.dom.Document currDoc)
Creates a new XPDocument object.

Parameters:
currDoc - - underlying currdoc
Method Detail

CreateAttribute

public XPAttr CreateAttribute(java.lang.String name)
Creates an XPAttr of the given name.

Parameters:
name - - string of attribute name.
Returns:
a new attribute.

CreateAttributeNS

public XPAttr CreateAttributeNS(java.lang.String namespaceURI,
                                java.lang.String qualifiedName)
Creates an attribute of the given qualified name and namespace URI.

Parameters:
namespaceURI - - namespace URI of the attribute to create
qualifiedName - - name used in creation
Returns:
a new attribute with a namespace

CreateComment

public XPComment CreateComment(java.lang.String data)
Creates a XPComment node given the specified string.

Parameters:
data - - data of new comment
Returns:
a new comment

CreateDataSection

public XPCDATASection CreateDataSection(java.lang.String data)
Creates a XPCDATASection node whose value is the specified string.

Parameters:
data - - data value to be created
Returns:
a new cdata section

CreateDocumentFragment

public XPDocumentFragment CreateDocumentFragment()
Creates an empty XPDocumentFragment object.

Returns:
a new document fragment

CreateElement

public XPElement CreateElement(java.lang.String tagName)
Creates an element of the type specified.

Parameters:
tagName - - element's name
Returns:
a new element

CreateElementNS

public XPElement CreateElementNS(java.lang.String namespaceURI,
                                 java.lang.String qualifiedName)
Creates an element of the given qualified name and namespace URI.

Parameters:
namespaceURI - - namespace of element
qualifiedName - - name of element to be created
Returns:
a new element with a namespace

CreateProcessingInstruction

public XPProcessingInstruction CreateProcessingInstruction(java.lang.String target,
                                                           java.lang.String data)
Creates a XPProcessingInstruction node given the specified name and data strings.

Parameters:
target - - target part of the processing instruction.
data - - data for the node.
Returns:
a new processing instr

CreateTextNode

public XPText CreateTextNode(java.lang.String value)
Creates a XPText node given the specified string.

Parameters:
value - - text node's value
Returns:
a new text node

GetDocType

public XPDocumentType GetDocType()
The Document Type Declaration (see XPDocumentType) associated with this document.

Returns:
the document's type

GetDocumentElement

public XPElement GetDocumentElement()
This is a convenience attribute that allows direct access to the child node that is the root element of the document.

Returns:
the root element

GetElementByID

public XPElement GetElementByID(java.lang.String elementID)
Returns the XPElement whose ID is given by elementId.

Parameters:
elementID - - element's id value
Returns:
the element based on the given id

GetElementsByTagName

public XPNodeList GetElementsByTagName(java.lang.String tagName)
Returns a XPNodeList of all the XPElements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the XPDocument tree.

Parameters:
tagName - - name for which to search
Returns:
all elements with the given name

GetElementsByTagNameNS

public XPNodeList GetElementsByTagNameNS(java.lang.String namespaceURI,
                                         java.lang.String localName)
Returns a XPNodeList of all the XPElements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the XPDocument tree.

Parameters:
namespaceURI - - namespace in which to look for elements
localName - - name of elements
Returns:
all elements with that tagname and namespace

GetUnderlyingObject

public org.w3c.dom.Node GetUnderlyingObject()
Retrieve the underlying Node object.

Overrides:
GetUnderlyingObject in class XPNode
Returns:
the underlying document

SetEncoding

public void SetEncoding(java.lang.String encoding)
Set the encoding of this XPDocument (part of XML Declaration).

Parameters:
encoding - - name of the encoding

GetEncoding

public java.lang.String GetEncoding()
Return this XPDocument's encoding string.

Returns:
The encoding of this XPDocument (part of XML Declaration)

ImportNode

public XPNode ImportNode(XPNode importedNode,
                         boolean deep)
Imports a node from another document to this document.

Parameters:
importedNode - - node to be imported
deep - - deep vs shallow copy
Returns:
the imported node


Copyright © 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.