Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.axis
Class SOAPPart  view SOAPPart download SOAPPart.java

java.lang.Object
  extended byjavax.xml.soap.SOAPPart
      extended byorg.apache.axis.SOAPPart
All Implemented Interfaces:
org.w3c.dom.Document, org.w3c.dom.Node, Part, java.io.Serializable

public class SOAPPart
extends javax.xml.soap.SOAPPart
implements Part

The SOAPPart provides access to the root part of the Message which contains the envelope.

SOAPPart implements Part, providing common MIME operations.

SOAPPart also allows access to its envelope, as a string, byte[], InputStream, or SOAPEnvelope. (This functionality used to be in Message, and has been moved here more or less verbatim pending further cleanup.)


Field Summary
static java.lang.String ALLOW_FORM_OPTIMIZATION
          property used to set SOAPEnvelope as default form
private  javax.xml.transform.Source contentSource
          Field contentSource.
private  java.lang.String currentEncoding
          default message encoding charset
private  int currentForm
           
private  java.lang.Object currentMessage
          The current representation of the SOAP contents of this part.
private  byte[] currentMessageAsBytes
           
private  org.apache.axis.message.SOAPEnvelope currentMessageAsEnvelope
           
private  java.lang.String currentMessageAsString
           
private  org.w3c.dom.Document document
          Implementation of org.w3c.Document Most of methods will be implemented using the delgate instance of SOAPDocumentImpl This is for two reasons: - possible change of message classes, by extenstion of xerces implementation - we cannot extends SOAPPart (multiple inheritance), since it is defined as Abstract class ***********************************************************
static int FORM_BODYINSTREAM
           
static int FORM_BYTES
           
static int FORM_FAULT
           
static int FORM_INPUTSTREAM
           
static int FORM_OPTIMIZED
           
static int FORM_SOAPENVELOPE
           
static int FORM_STRING
           
private static java.lang.String[] formNames
           
protected static org.apache.commons.logging.Log log
           
protected  org.w3c.dom.Document mDocument
          SOAPEnvelope is the Document Elements of this XML docuement
private  org.apache.axis.message.MimeHeaders mimeHeaders
           
private  Message msgObject
          Message object this part is tied to.
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
SOAPPart(Message parent, java.lang.Object initialContents, boolean isBodyStream)
          Create a new SOAPPart.
 
Method Summary
 void addMimeHeader(java.lang.String header, java.lang.String value)
          Add the specified MIME header, as per JAXM.
 org.w3c.dom.Node adoptNode(org.w3c.dom.Node node)
          Attempts to adopt a node from another document to this document.
 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
          Adds the node newChild to the end of the list of children of this node.
 org.w3c.dom.Node cloneNode(boolean deep)
          Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
 org.w3c.dom.Attr createAttribute(java.lang.String name)
          Creates an Attr of the given name.
 org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Creates an attribute of the given qualified name and namespace URI.
 org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
          Creates a CDATASection node whose value is the specified string.
 org.w3c.dom.Comment createComment(java.lang.String data)
          Creates a Comment node given the specified string.
 org.w3c.dom.DocumentFragment createDocumentFragment()
          Creates an empty DocumentFragment object.
 org.w3c.dom.Element createElement(java.lang.String tagName)
          Creates an element of the type specified.
 org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Creates an element of the given qualified name and namespace URI.
 org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
          Creates an EntityReference object.
 org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
          Creates a ProcessingInstruction node given the specified name and data strings.
 org.w3c.dom.Text createTextNode(java.lang.String data)
          Creates a Text node given the specified string.
 java.util.Iterator getAllMimeHeaders()
          Retrieves all the headers for this SOAPPart object as an iterator over the MimeHeader objects.
 byte[] getAsBytes()
          Get the contents of this Part (not the headers!), as a byte array.
 org.apache.axis.message.SOAPEnvelope getAsSOAPEnvelope()
          Get the contents of this Part (not the MIME headers!), as a SOAPEnvelope.
 java.lang.String getAsString()
          Get the contents of this Part (not the headers!), as a String.
 org.w3c.dom.NamedNodeMap getAttributes()
          A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
 org.w3c.dom.NodeList getChildNodes()
          A NodeList that contains all children of this node.
 javax.xml.transform.Source getContent()
          Returns the content of the SOAPEnvelope as a JAXP Source object.
 java.lang.String getContentId()
          Content ID.
 java.lang.String getContentIdRef()
          Content ID.
 long getContentLength()
          Get the content length for this SOAPPart.
 java.lang.String getContentLocation()
          Content location.
 java.lang.String getContentType()
          Content type is always "text/xml" for SOAPParts.
 int getCurrentForm()
           
 java.lang.Object getCurrentMessage()
          Get the current message, in whatever form it happens to be right now.
 org.w3c.dom.DocumentType getDoctype()
          The Document Type Declaration (see DocumentType) associated with this document.
 org.w3c.dom.Element getDocumentElement()
          This is a convenience attribute that allows direct access to the child node that is the document element of the document.
 org.w3c.dom.Element getElementById(java.lang.String elementId)
          Returns the Element that has an ID attribute with the given value.
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
          Returns a NodeList of all the Elements in document order with a given tag name and are contained in the document.
 org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
          Returns a NodeList of all the Elements with a given local name and namespace URI in document order.
 java.lang.String getEncoding()
           
 javax.xml.soap.SOAPEnvelope getEnvelope()
          Gets the SOAPEnvelope object associated with this SOAPPart object.
 org.w3c.dom.Node getFirstChild()
          The first child of this node.
private  java.lang.String getFirstMimeHeader(java.lang.String header)
          Get the specified MIME header.
 org.w3c.dom.DOMImplementation getImplementation()
          The DOMImplementation object that handles this document.
 org.w3c.dom.Node getLastChild()
          The last child of this node.
 java.lang.String getLocalName()
          Returns the local part of the qualified name of this node.
 java.util.Iterator getMatchingMimeHeaders(java.lang.String[] match)
          Get all headers that match.
 Message getMessage()
          Get the Message for this Part.
 java.lang.String[] getMimeHeader(java.lang.String name)
          Gets all the values of the MimeHeader object in this SOAPPart object that is identified by the given String.
 java.lang.String getNamespaceURI()
          The namespace URI of this node, or null if it is unspecified (see ).
 org.w3c.dom.Node getNextSibling()
          The node immediately following this node.
 java.lang.String getNodeName()
          Node Implementation
 short getNodeType()
          A code representing the type of the underlying object, as defined above.
 java.lang.String getNodeValue()
          The value of this node, depending on its type; see the table above.
 java.util.Iterator getNonMatchingMimeHeaders(java.lang.String[] match)
          Get all headers that do not match.
 org.w3c.dom.Document getOwnerDocument()
          The Document object associated with this node.
 org.w3c.dom.Node getParentNode()
          The parent of this node.
 java.lang.String getPrefix()
          The namespace prefix of this node, or null if it is unspecified.
 org.w3c.dom.Node getPreviousSibling()
          The node immediately preceding this node.
 org.w3c.dom.Document getSOAPDocument()
           
 boolean getStandalone()
           
 boolean getStrictErrorChecking()
          An attribute specifying whether error checking is enforced or not.
 java.lang.String getVersion()
           
 boolean hasAttributes()
          Returns whether this node (if it is an element) has any attributes.
 boolean hasChildNodes()
          Returns whether this node has any children.
 org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep)
          Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node.
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
          Inserts the node newChild before the existing child node refChild.
 boolean isBodyStream()
           
private  boolean isFormOptimizationAllowed()
          check if the allow optimization flag is on
 boolean isSupported(java.lang.String feature, java.lang.String version)
          Tests whether the DOM implementation implements a specific feature and that feature is supported by this node, as specified in .
 void normalize()
          Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
 void removeAllMimeHeaders()
          Removes all the MimeHeader objects for this SOAPEnvelope object.
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
          Removes the child node indicated by oldChild from the list of children, and returns it.
 void removeMimeHeader(java.lang.String header)
          Removes all MIME headers that match the given name.
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
          Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
 void saveChanges()
           
 void setContent(javax.xml.transform.Source source)
          Sets the content of the SOAPEnvelope object with the data from the given Source object.
 void setContentId(java.lang.String newCid)
          Sets Content-Id of this part.
 void setContentLocation(java.lang.String loc)
          Set content location.
private  void setCurrentForm(java.lang.Object currMsg, int form)
          Set the current contents of this Part.
 void setCurrentMessage(java.lang.Object currMsg, int form)
          Set the current message
 void setEncoding(java.lang.String s)
           
 void setMessage(Message msg)
          Set the Message for this Part.
 void setMimeHeader(java.lang.String name, java.lang.String value)
          Changes the first header entry that matches the given header name so that its value is the given value, adding a new header with the given name and value if no existing header is a match.
 void setNodeValue(java.lang.String nodeValue)
          The value of this node, depending on its type; see the table above.
 void setPrefix(java.lang.String prefix)
          The namespace prefix of this node, or null if it is unspecified.
 void setSOAPEnvelope(org.apache.axis.message.SOAPEnvelope env)
          This set the SOAP Envelope for this part.
 void setStandalone(boolean flag)
           
 void setStrictErrorChecking(boolean flag)
          An attribute specifying whether error checking is enforced or not.
 void setVersion(java.lang.String s)
           
 void writeTo(java.io.OutputStream os)
          Write the contents to the specified stream.
 void writeTo(java.io.Writer writer)
          Write the contents to the specified writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Document
getDocumentURI, getDomConfig, getInputEncoding, getXmlEncoding, getXmlStandalone, getXmlVersion, normalizeDocument, renameNode, setDocumentURI, setXmlStandalone, setXmlVersion
 
Methods inherited from interface org.w3c.dom.Node
compareDocumentPosition, getBaseURI, getFeature, getTextContent, getUserData, isDefaultNamespace, isEqualNode, isSameNode, lookupNamespaceURI, lookupPrefix, setTextContent, setUserData
 

Field Detail

log

protected static org.apache.commons.logging.Log log

FORM_STRING

public static final int FORM_STRING
See Also:
Constant Field Values

FORM_INPUTSTREAM

public static final int FORM_INPUTSTREAM
See Also:
Constant Field Values

FORM_SOAPENVELOPE

public static final int FORM_SOAPENVELOPE
See Also:
Constant Field Values

FORM_BYTES

public static final int FORM_BYTES
See Also:
Constant Field Values

FORM_BODYINSTREAM

public static final int FORM_BODYINSTREAM
See Also:
Constant Field Values

FORM_FAULT

public static final int FORM_FAULT
See Also:
Constant Field Values

FORM_OPTIMIZED

public static final int FORM_OPTIMIZED
See Also:
Constant Field Values

currentForm

private int currentForm

ALLOW_FORM_OPTIMIZATION

public static final java.lang.String ALLOW_FORM_OPTIMIZATION
property used to set SOAPEnvelope as default form

See Also:
Constant Field Values

mimeHeaders

private org.apache.axis.message.MimeHeaders mimeHeaders

formNames

private static final java.lang.String[] formNames

currentMessage

private java.lang.Object currentMessage
The current representation of the SOAP contents of this part. May be a String, byte[], InputStream, or SOAPEnvelope, depending on whatever was last asked for. (ack)

currentForm must have the corresponding value.

As someone once said: "Just a placeholder until we figure out what the actual Message object is."


currentEncoding

private java.lang.String currentEncoding
default message encoding charset


currentMessageAsString

private java.lang.String currentMessageAsString

currentMessageAsBytes

private byte[] currentMessageAsBytes

currentMessageAsEnvelope

private org.apache.axis.message.SOAPEnvelope currentMessageAsEnvelope

msgObject

private Message msgObject
Message object this part is tied to. Used for serialization settings.


contentSource

private javax.xml.transform.Source contentSource
Field contentSource.


document

private org.w3c.dom.Document document
Implementation of org.w3c.Document Most of methods will be implemented using the delgate instance of SOAPDocumentImpl This is for two reasons: - possible change of message classes, by extenstion of xerces implementation - we cannot extends SOAPPart (multiple inheritance), since it is defined as Abstract class ***********************************************************


mDocument

protected org.w3c.dom.Document mDocument
SOAPEnvelope is the Document Elements of this XML docuement

Constructor Detail

SOAPPart

public SOAPPart(Message parent,
                java.lang.Object initialContents,
                boolean isBodyStream)
Create a new SOAPPart.

Do not call this directly! Should only be called by Message.

Method Detail

getMessage

public Message getMessage()
Get the Message for this Part.


setMessage

public void setMessage(Message msg)
Set the Message for this Part. Do not call this Directly. Called by Message.


getContentType

public java.lang.String getContentType()
Content type is always "text/xml" for SOAPParts.

Specified by:
getContentType in interface Part

getContentLength

public long getContentLength()
                      throws AxisFault
Get the content length for this SOAPPart. This will force buffering of the SOAPPart, but it will also cache the byte[] form of the SOAPPart.


setSOAPEnvelope

public void setSOAPEnvelope(org.apache.axis.message.SOAPEnvelope env)
This set the SOAP Envelope for this part.

Note: It breaks the chicken/egg created. I need a message to create an attachment... From the attachment I should be able to get a reference... I now want to edit elements in the envelope in order to place the attachment reference to it. How do I now update the SOAP envelope with what I've changed?


writeTo

public void writeTo(java.io.OutputStream os)
             throws java.io.IOException
Write the contents to the specified stream.


writeTo

public void writeTo(java.io.Writer writer)
             throws java.io.IOException
Write the contents to the specified writer.


getCurrentMessage

public java.lang.Object getCurrentMessage()
Get the current message, in whatever form it happens to be right now. Will return a String, byte[], InputStream, or SOAPEnvelope, depending on circumstances.

The method name is historical. TODO: rename this for clarity; should be more like getContents.


setCurrentMessage

public void setCurrentMessage(java.lang.Object currMsg,
                              int form)
Set the current message


setCurrentForm

private void setCurrentForm(java.lang.Object currMsg,
                            int form)
Set the current contents of this Part. The method name is historical. TODO: rename this for clarity to something more like setContents???


isFormOptimizationAllowed

private boolean isFormOptimizationAllowed()
check if the allow optimization flag is on


getCurrentForm

public int getCurrentForm()

getAsBytes

public byte[] getAsBytes()
                  throws AxisFault
Get the contents of this Part (not the headers!), as a byte array. This will force buffering of the message.


saveChanges

public void saveChanges()
                 throws AxisFault

getAsString

public java.lang.String getAsString()
                             throws AxisFault
Get the contents of this Part (not the headers!), as a String. This will force buffering of the message.


getAsSOAPEnvelope

public org.apache.axis.message.SOAPEnvelope getAsSOAPEnvelope()
                                                       throws AxisFault
Get the contents of this Part (not the MIME headers!), as a SOAPEnvelope. This will force a complete parse of the message.


addMimeHeader

public void addMimeHeader(java.lang.String header,
                          java.lang.String value)
Add the specified MIME header, as per JAXM.

Specified by:
addMimeHeader in interface Part

getFirstMimeHeader

private java.lang.String getFirstMimeHeader(java.lang.String header)
Get the specified MIME header.


getContentLocation

public java.lang.String getContentLocation()
Content location.

Specified by:
getContentLocation in interface Part

setContentLocation

public void setContentLocation(java.lang.String loc)
Set content location.

Specified by:
setContentLocation in interface Part

setContentId

public void setContentId(java.lang.String newCid)
Sets Content-Id of this part. already defined.

Specified by:
setContentId in interface Part

getContentId

public java.lang.String getContentId()
Content ID.

Specified by:
getContentId in interface Part

getContentIdRef

public java.lang.String getContentIdRef()
Content ID.

Specified by:
getContentIdRef in interface Part

getMatchingMimeHeaders

public java.util.Iterator getMatchingMimeHeaders(java.lang.String[] match)
Get all headers that match.

Specified by:
getMatchingMimeHeaders in interface Part

getNonMatchingMimeHeaders

public java.util.Iterator getNonMatchingMimeHeaders(java.lang.String[] match)
Get all headers that do not match.

Specified by:
getNonMatchingMimeHeaders in interface Part

setContent

public void setContent(javax.xml.transform.Source source)
                throws javax.xml.soap.SOAPException
Sets the content of the SOAPEnvelope object with the data from the given Source object.


getContent

public javax.xml.transform.Source getContent()
                                      throws javax.xml.soap.SOAPException
Returns the content of the SOAPEnvelope as a JAXP Source object.


getAllMimeHeaders

public java.util.Iterator getAllMimeHeaders()
Retrieves all the headers for this SOAPPart object as an iterator over the MimeHeader objects.


setMimeHeader

public void setMimeHeader(java.lang.String name,
                          java.lang.String value)
Changes the first header entry that matches the given header name so that its value is the given value, adding a new header with the given name and value if no existing header is a match. If there is a match, this method clears all existing values for the first header that matches and sets the given value instead. If more than one header has the given name, this method removes all of the matching headers after the first one.

Note that RFC822 headers can contain only US-ASCII characters.


getMimeHeader

public java.lang.String[] getMimeHeader(java.lang.String name)
Gets all the values of the MimeHeader object in this SOAPPart object that is identified by the given String.

Specified by:
getMimeHeader in interface Part

removeAllMimeHeaders

public void removeAllMimeHeaders()
Removes all the MimeHeader objects for this SOAPEnvelope object.


removeMimeHeader

public void removeMimeHeader(java.lang.String header)
Removes all MIME headers that match the given name.


getEnvelope

public javax.xml.soap.SOAPEnvelope getEnvelope()
                                        throws javax.xml.soap.SOAPException
Gets the SOAPEnvelope object associated with this SOAPPart object. Once the SOAP envelope is obtained, it can be used to get its contents.


getSOAPDocument

public org.w3c.dom.Document getSOAPDocument()
Since:
SAAJ 1.2

getDoctype

public org.w3c.dom.DocumentType getDoctype()
Description copied from interface: org.w3c.dom.Document
The Document Type Declaration (see DocumentType) associated with this document. For XML documents without a document type declaration this returns null. For HTML documents, a DocumentType object may be returned, independently of the presence or absence of document type declaration in the HTML document.
This provides direct access to the DocumentType node, child node of this Document. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such as Node.insertBefore, or Node.replaceChild. Note, however, that while some implementations may instantiate different types of Document objects supporting additional features than the "Core", such as "HTML" [DOM Level 2 HTML] , based on the DocumentType specified at creation time, changing it afterwards is very unlikely to result in a change of the features supported.

Specified by:
getDoctype in interface org.w3c.dom.Document

getImplementation

public org.w3c.dom.DOMImplementation getImplementation()
Description copied from interface: org.w3c.dom.Document
The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.

Specified by:
getImplementation in interface org.w3c.dom.Document

getDocumentElement

public org.w3c.dom.Element getDocumentElement()
Description copied from interface: org.w3c.dom.Document
This is a convenience attribute that allows direct access to the child node that is the document element of the document.

Specified by:
getDocumentElement in interface org.w3c.dom.Document

createElement

public org.w3c.dom.Element createElement(java.lang.String tagName)
                                  throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Document
Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object.
In addition, if there are known attributes with default values, Attr nodes representing them are automatically created and attached to the element.
To create an element with a qualified name and namespace URI, use the createElementNS method.

Specified by:
createElement in interface org.w3c.dom.Document

createDocumentFragment

public org.w3c.dom.DocumentFragment createDocumentFragment()
Description copied from interface: org.w3c.dom.Document
Creates an empty DocumentFragment object.

Specified by:
createDocumentFragment in interface org.w3c.dom.Document

createTextNode

public org.w3c.dom.Text createTextNode(java.lang.String data)
Description copied from interface: org.w3c.dom.Document
Creates a Text node given the specified string.

Specified by:
createTextNode in interface org.w3c.dom.Document

createComment

public org.w3c.dom.Comment createComment(java.lang.String data)
Description copied from interface: org.w3c.dom.Document
Creates a Comment node given the specified string.

Specified by:
createComment in interface org.w3c.dom.Document

createCDATASection

public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
                                            throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Document
Creates a CDATASection node whose value is the specified string.

Specified by:
createCDATASection in interface org.w3c.dom.Document

createProcessingInstruction

public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                                     java.lang.String data)
                                                              throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Document
Creates a ProcessingInstruction node given the specified name and data strings.

Specified by:
createProcessingInstruction in interface org.w3c.dom.Document

createAttribute

public org.w3c.dom.Attr createAttribute(java.lang.String name)
                                 throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Document
Creates an Attr of the given name. Note that the Attr instance can then be set on an Element using the setAttributeNode method.
To create an attribute with a qualified name and namespace URI, use the createAttributeNS method.

Specified by:
createAttribute in interface org.w3c.dom.Document

createEntityReference

public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
                                                  throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Document
Creates an EntityReference object. In addition, if the referenced entity is known, the child list of the EntityReference node is made the same as that of the corresponding Entity node.

Note: If any descendant of the Entity node has an unbound namespace prefix, the corresponding descendant of the created EntityReference node is also unbound; (its namespaceURI is null). The DOM Level 2 and 3 do not support any mechanism to resolve namespace prefixes in this case.

Specified by:
createEntityReference in interface org.w3c.dom.Document

getElementsByTagName

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
Description copied from interface: org.w3c.dom.Document
Returns a NodeList of all the Elements in document order with a given tag name and are contained in the document.

Specified by:
getElementsByTagName in interface org.w3c.dom.Document

importNode

public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode,
                                   boolean deep)
                            throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Document
Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node. The returned node has no parent; (parentNode is null).
For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node's nodeName and nodeType, plus the attributes related to namespaces (prefix, localName, and namespaceURI). As in the cloneNode operation, the source node is not altered. User data associated to the imported node is not carried over. However, if any UserDataHandlers has been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.
Additional information is copied as appropriate to the nodeType, attempting to mirror the behavior expected if a fragment of XML or HTML source was copied from one document to another, recognizing that the two documents may have different DTDs in the XML case. The following list describes the specifics for each type of node.
ATTRIBUTE_NODE
The ownerElement attribute is set to null and the specified flag is set to true on the generated Attr. The descendants of the source Attr are recursively imported and the resulting nodes reassembled to form the corresponding subtree. Note that the deep parameter has no effect on Attr nodes; they always carry their children with them when imported.
DOCUMENT_FRAGMENT_NODE
If the deep option was set to true, the descendants of the source DocumentFragment are recursively imported and the resulting nodes reassembled under the imported DocumentFragment to form the corresponding subtree. Otherwise, this simply generates an empty DocumentFragment.
DOCUMENT_NODE
Document nodes cannot be imported.
DOCUMENT_TYPE_NODE
DocumentType nodes cannot be imported.
ELEMENT_NODE
Specified attribute nodes of the source element are imported, and the generated Attr nodes are attached to the generated Element. Default attributes are not copied, though if the document being imported into defines default attributes for this element name, those are assigned. If the importNode deep parameter was set to true, the descendants of the source element are recursively imported and the resulting nodes reassembled to form the corresponding subtree.
ENTITY_NODE
Entity nodes can be imported, however in the current release of the DOM the DocumentType is readonly. Ability to add these imported nodes to a DocumentType will be considered for addition to a future release of the DOM.On import, the publicId, systemId, and notationName attributes are copied. If a deep import is requested, the descendants of the the source Entity are recursively imported and the resulting nodes reassembled to form the corresponding subtree.
ENTITY_REFERENCE_NODE
Only the EntityReference itself is copied, even if a deep import is requested, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.
NOTATION_NODE
Notation nodes can be imported, however in the current release of the DOM the DocumentType is readonly. Ability to add these imported nodes to a DocumentType will be considered for addition to a future release of the DOM.On import, the publicId and systemId attributes are copied. Note that the deep parameter has no effect on this type of nodes since they cannot have any children.
PROCESSING_INSTRUCTION_NODE
The imported node copies its target and data values from those of the source node.Note that the deep parameter has no effect on this type of nodes since they cannot have any children.
TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE
These three types of nodes inheriting from CharacterData copy their data and length attributes from those of the source node.Note that the deep parameter has no effect on these types of nodes since they cannot have any children.

Specified by:
importNode in interface org.w3c.dom.Document

createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI,
                                           java.lang.String qualifiedName)
                                    throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Document
Creates an element of the given qualified name and namespace URI.
Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Specified by:
createElementNS in interface org.w3c.dom.Document

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                          java.lang.String qualifiedName)
                                   throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Document
Creates an attribute of the given qualified name and namespace URI.
Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Specified by:
createAttributeNS in interface org.w3c.dom.Document

getElementsByTagNameNS

public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                                   java.lang.String localName)
Description copied from interface: org.w3c.dom.Document
Returns a NodeList of all the Elements with a given local name and namespace URI in document order.

Specified by:
getElementsByTagNameNS in interface org.w3c.dom.Document

getElementById

public org.w3c.dom.Element getElementById(java.lang.String elementId)
Description copied from interface: org.w3c.dom.Document
Returns the Element that has an ID attribute with the given value. If no such element exists, this returns null . If more than one element has an ID attribute with that value, what is returned is undefined.
The DOM implementation is expected to use the attribute Attr.isId to determine if an attribute is of type ID.

Note: Attributes with the name "ID" or "id" are not of type ID unless so defined.

Specified by:
getElementById in interface org.w3c.dom.Document

getEncoding

public java.lang.String getEncoding()

setEncoding

public void setEncoding(java.lang.String s)

getStandalone

public boolean getStandalone()

setStandalone

public void setStandalone(boolean flag)

getStrictErrorChecking

public boolean getStrictErrorChecking()
Description copied from interface: org.w3c.dom.Document
An attribute specifying whether error checking is enforced or not. When set to false, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any DOMException on DOM operations or report errors while using Document.normalizeDocument(). In case of error, the behavior is undefined. This attribute is true by default.

Specified by:
getStrictErrorChecking in interface org.w3c.dom.Document

setStrictErrorChecking

public void setStrictErrorChecking(boolean flag)
Description copied from interface: org.w3c.dom.Document
An attribute specifying whether error checking is enforced or not. When set to false, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any DOMException on DOM operations or report errors while using Document.normalizeDocument(). In case of error, the behavior is undefined. This attribute is true by default.

Specified by:
setStrictErrorChecking in interface org.w3c.dom.Document

getVersion

public java.lang.String getVersion()

setVersion

public void setVersion(java.lang.String s)

adoptNode

public org.w3c.dom.Node adoptNode(org.w3c.dom.Node node)
                           throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Document
Attempts to adopt a node from another document to this document. If supported, it changes the ownerDocument of the source node, its children, as well as the attached attribute nodes if there are any. If the source node has a parent it is first removed from the child list of its parent. This effectively allows moving a subtree from one document to another (unlike importNode() which create a copy of the source node instead of moving it). When it fails, applications should use Document.importNode() instead. Note that if the adopted node is already part of this document (i.e. the source and target document are the same), this method still has the effect of removing the source node from the child list of its parent, if any. The following list describes the specifics for each type of node.
ATTRIBUTE_NODE
The ownerElement attribute is set to null and the specified flag is set to true on the adopted Attr. The descendants of the source Attr are recursively adopted.
DOCUMENT_FRAGMENT_NODE
The descendants of the source node are recursively adopted.
DOCUMENT_NODE
Document nodes cannot be adopted.
DOCUMENT_TYPE_NODE
DocumentType nodes cannot be adopted.
ELEMENT_NODE
Specified attribute nodes of the source element are adopted. Default attributes are discarded, though if the document being adopted into defines default attributes for this element name, those are assigned. The descendants of the source element are recursively adopted.
ENTITY_NODE
Entity nodes cannot be adopted.
ENTITY_REFERENCE_NODE
Only the EntityReference node itself is adopted, the descendants are discarded, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.
NOTATION_NODE
Notation nodes cannot be adopted.
PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE
These nodes can all be adopted. No specifics.

Note: Since it does not create new nodes unlike the Document.importNode() method, this method does not raise an INVALID_CHARACTER_ERR exception, and applications should use the Document.normalizeDocument() method to check if an imported name is not an XML name according to the XML version in use.

Specified by:
adoptNode in interface org.w3c.dom.Document

getNodeName

public java.lang.String getNodeName()
Node Implementation

Specified by:
getNodeName in interface org.w3c.dom.Node

getNodeValue

public java.lang.String getNodeValue()
                              throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
The value of this node, depending on its type; see the table above. When it is defined to be null, setting it has no effect, including if the node is read-only.

Specified by:
getNodeValue in interface org.w3c.dom.Node

setNodeValue

public void setNodeValue(java.lang.String nodeValue)
                  throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
The value of this node, depending on its type; see the table above. When it is defined to be null, setting it has no effect, including if the node is read-only.

Specified by:
setNodeValue in interface org.w3c.dom.Node

getNodeType

public short getNodeType()
Description copied from interface: org.w3c.dom.Node
A code representing the type of the underlying object, as defined above.

Specified by:
getNodeType in interface org.w3c.dom.Node

getParentNode

public org.w3c.dom.Node getParentNode()
Description copied from interface: org.w3c.dom.Node
The parent of this node. All nodes, except Attr, Document, DocumentFragment, Entity, and Notation may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.

Specified by:
getParentNode in interface org.w3c.dom.Node

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
Description copied from interface: org.w3c.dom.Node
A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes.

Specified by:
getChildNodes in interface org.w3c.dom.Node

getFirstChild

public org.w3c.dom.Node getFirstChild()
Description copied from interface: org.w3c.dom.Node
The first child of this node. If there is no such node, this returns null.

Specified by:
getFirstChild in interface org.w3c.dom.Node

getLastChild

public org.w3c.dom.Node getLastChild()
Description copied from interface: org.w3c.dom.Node
The last child of this node. If there is no such node, this returns null.

Specified by:
getLastChild in interface org.w3c.dom.Node

getPreviousSibling

public org.w3c.dom.Node getPreviousSibling()
Description copied from interface: org.w3c.dom.Node
The node immediately preceding this node. If there is no such node, this returns null.

Specified by:
getPreviousSibling in interface org.w3c.dom.Node

getNextSibling

public org.w3c.dom.Node getNextSibling()
Description copied from interface: org.w3c.dom.Node
The node immediately following this node. If there is no such node, this returns null.

Specified by:
getNextSibling in interface org.w3c.dom.Node

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()
Description copied from interface: org.w3c.dom.Node
A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.

Specified by:
getAttributes in interface org.w3c.dom.Node

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
Description copied from interface: org.w3c.dom.Node
The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null.

Specified by:
getOwnerDocument in interface org.w3c.dom.Node

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
Inserts the node newChild before the existing child node refChild. If refChild is null, insert newChild at the end of the list of children.
If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed.

Note: Inserting a node before itself is implementation dependent.

Specified by:
insertBefore in interface org.w3c.dom.Node

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
If newChild is a DocumentFragment object, oldChild is replaced by all of the DocumentFragment children, which are inserted in the same order. If the newChild is already in the tree, it is first removed.

Note: Replacing a node with itself is implementation dependent.

Specified by:
replaceChild in interface org.w3c.dom.Node

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
Removes the child node indicated by oldChild from the list of children, and returns it.

Specified by:
removeChild in interface org.w3c.dom.Node

appendChild

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                             throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.

Specified by:
appendChild in interface org.w3c.dom.Node

hasChildNodes

public boolean hasChildNodes()
Description copied from interface: org.w3c.dom.Node
Returns whether this node has any children.

Specified by:
hasChildNodes in interface org.w3c.dom.Node

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Description copied from interface: org.w3c.dom.Node
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent ( parentNode is null) and no user data. User data associated to the imported node is not carried over. However, if any UserDataHandlers has been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.
Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any children it contains unless it is a deep clone. This includes text contained in an the Element since the text is contained in a child Text node. Cloning an Attr directly, as opposed to be cloned as part of an Element cloning operation, returns a specified attribute (specified is true). Cloning an Attr always clones its children, since they represent its value, no matter whether this is a deep clone or not. Cloning an EntityReference automatically constructs its subtree if a corresponding Entity is available, no matter whether this is a deep clone or not. Cloning any other type of node simply returns a copy of this node.
Note that cloning an immutable subtree results in a mutable copy, but the children of an EntityReference clone are readonly . In addition, clones of unspecified Attr nodes are specified. And, cloning Document, DocumentType, Entity, and Notation nodes is implementation dependent.

Specified by:
cloneNode in interface org.w3c.dom.Node

normalize

public void normalize()
Description copied from interface: org.w3c.dom.Node
Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer [XPointer] lookups) that depend on a particular document tree structure are to be used. If the parameter "normalize-characters" of the DOMConfiguration object attached to the Node.ownerDocument is true, this method will also fully normalize the characters of the Text nodes.

Note: In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes.

Specified by:
normalize in interface org.w3c.dom.Node

isSupported

public boolean isSupported(java.lang.String feature,
                           java.lang.String version)
Description copied from interface: org.w3c.dom.Node
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node, as specified in .

Specified by:
isSupported in interface org.w3c.dom.Node

getNamespaceURI

public java.lang.String getNamespaceURI()
Description copied from interface: org.w3c.dom.Node
The namespace URI of this node, or null if it is unspecified (see ).
This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as Document.createElement(), this is always null.

Note: Per the Namespaces in XML Specification [XML Namespaces] an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.

Specified by:
getNamespaceURI in interface org.w3c.dom.Node

getPrefix

public java.lang.String getPrefix()
Description copied from interface: org.w3c.dom.Node
The namespace prefix of this node, or null if it is unspecified. When it is defined to be null, setting it has no effect, including if the node is read-only.
Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable.
Setting the prefix to null makes it unspecified, setting it to an empty string is implementation dependent.
Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the namespaceURI and localName do not change.
For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.

Specified by:
getPrefix in interface org.w3c.dom.Node

setPrefix

public void setPrefix(java.lang.String prefix)
               throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
The namespace prefix of this node, or null if it is unspecified. When it is defined to be null, setting it has no effect, including if the node is read-only.
Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable.
Setting the prefix to null makes it unspecified, setting it to an empty string is implementation dependent.
Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the namespaceURI and localName do not change.
For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.

Specified by:
setPrefix in interface org.w3c.dom.Node

getLocalName

public java.lang.String getLocalName()
Description copied from interface: org.w3c.dom.Node
Returns the local part of the qualified name of this node.
For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as Document.createElement(), this is always null.

Specified by:
getLocalName in interface org.w3c.dom.Node

hasAttributes

public boolean hasAttributes()
Description copied from interface: org.w3c.dom.Node
Returns whether this node (if it is an element) has any attributes.

Specified by:
hasAttributes in interface org.w3c.dom.Node

isBodyStream

public boolean isBodyStream()