Package com.sun.xml.messaging.saaj.soap
Class SOAPDocumentImpl
- java.lang.Object
-
- com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl
-
- All Implemented Interfaces:
SOAPDocument,Node,Document,Node
public class SOAPDocumentImpl extends Object implements SOAPDocument, Node, Document
- Author:
- SAAJ RI Development Team
-
-
Field Summary
Fields Modifier and Type Field Description static StringSAAJ_NODE-
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
Constructors Constructor Description SOAPDocumentImpl(SOAPPartImpl enclosingDocument)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeadoptNode(Node source)NodeappendChild(Node newChild)NodecloneNode(boolean deep)shortcompareDocumentPosition(Node other)AttrcreateAttribute(String name)AttrcreateAttributeNS(String namespaceURI, String qualifiedName)CDATASectioncreateCDATASection(String data)CommentcreateComment(String data)DocumentFragmentcreateDocumentFragment()ElementcreateElement(String tagName)ElementcreateElementNS(String namespaceURI, String qualifiedName)EntityReferencecreateEntityReference(String name)ProcessingInstructioncreateProcessingInstruction(String target, String data)TextcreateTextNode(String data)voiddetachNode()Removes thisNodeobject from the tree.protected ElementdoGetDocumentElement()Nodefind(Node node)Find a soap wrapper for w3c dom node.NodefindIfPresent(Node node)If corresponding soap wrapper exists for w3c dom node it is returned, if not passed dom element is returned.NamedNodeMapgetAttributes()StringgetBaseURI()NodeListgetChildNodes()DocumentTypegetDoctype()SOAPDocumentImplgetDocument()ElementgetDocumentElement()StringgetDocumentURI()DOMConfigurationgetDomConfig()DocumentgetDomDocument()DocumentgetDomElement()NodegetDomNode(Node node)Extracts w3c dom node from corresponding soap wrapper.ElementgetElementById(String elementId)NodeListgetElementsByTagName(String tagname)NodeListgetElementsByTagNameNS(String namespaceURI, String localName)ObjectgetFeature(String feature, String version)NodegetFirstChild()DOMImplementationgetImplementation()StringgetInputEncoding()NodegetLastChild()StringgetLocalName()StringgetNamespaceURI()NodegetNextSibling()StringgetNodeName()shortgetNodeType()StringgetNodeValue()DocumentgetOwnerDocument()SOAPElementgetParentElement()Returns the parent element of thisNodeobject.NodegetParentNode()StringgetPrefix()NodegetPreviousSibling()SOAPPartImplgetSOAPPart()booleangetStrictErrorChecking()StringgetTextContent()ObjectgetUserData(String key)StringgetValue()Returns the value of this node if this is aTextnode or the value of the immediate child of this node otherwise.StringgetXmlEncoding()booleangetXmlStandalone()StringgetXmlVersion()booleanhasAttributes()booleanhasChildNodes()NodeimportNode(Node importedNode, boolean deep)NodeinsertBefore(Node newChild, Node refChild)booleanisDefaultNamespace(String namespaceURI)booleanisEqualNode(Node arg)booleanisSameNode(Node other)booleanisSupported(String feature, String version)StringlookupNamespaceURI(String prefix)StringlookupPrefix(String namespaceURI)voidnormalize()voidnormalizeDocument()voidrecycleNode()Notifies the implementation that thisNodeobject is no longer being used by the application and that the implementation is free to reuse this object for nodes that may be created later.voidregister(Node node)voidregisterChildNodes(Node parentNode, boolean deep)If the parentNode is not registered to domToSoap, create soap wapper for parentNode and register it to domToSoap If deep = true, also register all children transitively of parentNode to domToSoap map.NoderemoveChild(Node oldChild)NoderenameNode(Node n, String namespaceURI, String qualifiedName)NodereplaceChild(Node newChild, Node oldChild)voidsetDocumentURI(String documentURI)voidsetNodeValue(String nodeValue)voidsetParentElement(SOAPElement parent)Sets the parent of thisNodeobject to the givenSOAPElementobject.voidsetPrefix(String prefix)voidsetStrictErrorChecking(boolean strictErrorChecking)voidsetTextContent(String textContent)ObjectsetUserData(String key, Object data, UserDataHandler handler)voidsetValue(String value)If this is a Text node then this method will set its value, otherwise it sets the value of the immediate (Text) child of this node.voidsetXmlStandalone(boolean xmlStandalone)voidsetXmlVersion(String xmlVersion)
-
-
-
Field Detail
-
SAAJ_NODE
public static final String SAAJ_NODE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SOAPDocumentImpl
public SOAPDocumentImpl(SOAPPartImpl enclosingDocument)
-
-
Method Detail
-
getSOAPPart
public SOAPPartImpl getSOAPPart()
- Specified by:
getSOAPPartin interfaceSOAPDocument
-
getDocument
public SOAPDocumentImpl getDocument()
- Specified by:
getDocumentin interfaceSOAPDocument
-
getDoctype
public DocumentType getDoctype()
- Specified by:
getDoctypein interfaceDocument
-
getImplementation
public DOMImplementation getImplementation()
- Specified by:
getImplementationin interfaceDocument
-
getDocumentElement
public Element getDocumentElement()
- Specified by:
getDocumentElementin interfaceDocument
-
doGetDocumentElement
protected Element doGetDocumentElement()
-
createElement
public Element createElement(String tagName) throws DOMException
- Specified by:
createElementin interfaceDocument- Throws:
DOMException
-
createDocumentFragment
public DocumentFragment createDocumentFragment()
- Specified by:
createDocumentFragmentin interfaceDocument
-
createTextNode
public Text createTextNode(String data)
- Specified by:
createTextNodein interfaceDocument
-
createComment
public Comment createComment(String data)
- Specified by:
createCommentin interfaceDocument
-
createCDATASection
public CDATASection createCDATASection(String data) throws DOMException
- Specified by:
createCDATASectionin interfaceDocument- Throws:
DOMException
-
createProcessingInstruction
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException
- Specified by:
createProcessingInstructionin interfaceDocument- Throws:
DOMException
-
createAttribute
public Attr createAttribute(String name) throws DOMException
- Specified by:
createAttributein interfaceDocument- Throws:
DOMException
-
createEntityReference
public EntityReference createEntityReference(String name) throws DOMException
- Specified by:
createEntityReferencein interfaceDocument- Throws:
DOMException
-
getElementsByTagName
public NodeList getElementsByTagName(String tagname)
- Specified by:
getElementsByTagNamein interfaceDocument
-
importNode
public Node importNode(Node importedNode, boolean deep) throws DOMException
- Specified by:
importNodein interfaceDocument- Throws:
DOMException
-
registerChildNodes
public void registerChildNodes(Node parentNode, boolean deep)
If the parentNode is not registered to domToSoap, create soap wapper for parentNode and register it to domToSoap If deep = true, also register all children transitively of parentNode to domToSoap map.- Parameters:
parentNode- node to wrapdeep- wrap child nodes transitively
-
createElementNS
public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException
- Specified by:
createElementNSin interfaceDocument- Throws:
DOMException
-
createAttributeNS
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException
- Specified by:
createAttributeNSin interfaceDocument- Throws:
DOMException
-
getElementsByTagNameNS
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
- Specified by:
getElementsByTagNameNSin interfaceDocument
-
getElementById
public Element getElementById(String elementId)
- Specified by:
getElementByIdin interfaceDocument
-
getInputEncoding
public String getInputEncoding()
- Specified by:
getInputEncodingin interfaceDocument
-
getXmlEncoding
public String getXmlEncoding()
- Specified by:
getXmlEncodingin interfaceDocument
-
getXmlStandalone
public boolean getXmlStandalone()
- Specified by:
getXmlStandalonein interfaceDocument
-
setXmlStandalone
public void setXmlStandalone(boolean xmlStandalone) throws DOMException- Specified by:
setXmlStandalonein interfaceDocument- Throws:
DOMException
-
getXmlVersion
public String getXmlVersion()
- Specified by:
getXmlVersionin interfaceDocument
-
setXmlVersion
public void setXmlVersion(String xmlVersion) throws DOMException
- Specified by:
setXmlVersionin interfaceDocument- Throws:
DOMException
-
getStrictErrorChecking
public boolean getStrictErrorChecking()
- Specified by:
getStrictErrorCheckingin interfaceDocument
-
setStrictErrorChecking
public void setStrictErrorChecking(boolean strictErrorChecking)
- Specified by:
setStrictErrorCheckingin interfaceDocument
-
getDocumentURI
public String getDocumentURI()
- Specified by:
getDocumentURIin interfaceDocument
-
setDocumentURI
public void setDocumentURI(String documentURI)
- Specified by:
setDocumentURIin interfaceDocument
-
adoptNode
public Node adoptNode(Node source) throws DOMException
- Specified by:
adoptNodein interfaceDocument- Throws:
DOMException
-
getDomConfig
public DOMConfiguration getDomConfig()
- Specified by:
getDomConfigin interfaceDocument
-
normalizeDocument
public void normalizeDocument()
- Specified by:
normalizeDocumentin interfaceDocument
-
renameNode
public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException
- Specified by:
renameNodein interfaceDocument- Throws:
DOMException
-
getNodeName
public String getNodeName()
- Specified by:
getNodeNamein interfaceNode
-
getNodeValue
public String getNodeValue() throws DOMException
- Specified by:
getNodeValuein interfaceNode- Throws:
DOMException
-
setNodeValue
public void setNodeValue(String nodeValue) throws DOMException
- Specified by:
setNodeValuein interfaceNode- Throws:
DOMException
-
getNodeType
public short getNodeType()
- Specified by:
getNodeTypein interfaceNode
-
getParentNode
public Node getParentNode()
- Specified by:
getParentNodein interfaceNode
-
getChildNodes
public NodeList getChildNodes()
- Specified by:
getChildNodesin interfaceNode
-
getFirstChild
public Node getFirstChild()
- Specified by:
getFirstChildin interfaceNode
-
getLastChild
public Node getLastChild()
- Specified by:
getLastChildin interfaceNode
-
getPreviousSibling
public Node getPreviousSibling()
- Specified by:
getPreviousSiblingin interfaceNode
-
getNextSibling
public Node getNextSibling()
- Specified by:
getNextSiblingin interfaceNode
-
getAttributes
public NamedNodeMap getAttributes()
- Specified by:
getAttributesin interfaceNode
-
getOwnerDocument
public Document getOwnerDocument()
- Specified by:
getOwnerDocumentin interfaceNode
-
insertBefore
public Node insertBefore(Node newChild, Node refChild) throws DOMException
- Specified by:
insertBeforein interfaceNode- Throws:
DOMException
-
replaceChild
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
- Specified by:
replaceChildin interfaceNode- Throws:
DOMException
-
removeChild
public Node removeChild(Node oldChild) throws DOMException
- Specified by:
removeChildin interfaceNode- Throws:
DOMException
-
appendChild
public Node appendChild(Node newChild) throws DOMException
- Specified by:
appendChildin interfaceNode- Throws:
DOMException
-
hasChildNodes
public boolean hasChildNodes()
- Specified by:
hasChildNodesin interfaceNode
-
isSupported
public boolean isSupported(String feature, String version)
- Specified by:
isSupportedin interfaceNode
-
getNamespaceURI
public String getNamespaceURI()
- Specified by:
getNamespaceURIin interfaceNode
-
setPrefix
public void setPrefix(String prefix) throws DOMException
- Specified by:
setPrefixin interfaceNode- Throws:
DOMException
-
getLocalName
public String getLocalName()
- Specified by:
getLocalNamein interfaceNode
-
hasAttributes
public boolean hasAttributes()
- Specified by:
hasAttributesin interfaceNode
-
getBaseURI
public String getBaseURI()
- Specified by:
getBaseURIin interfaceNode
-
compareDocumentPosition
public short compareDocumentPosition(Node other) throws DOMException
- Specified by:
compareDocumentPositionin interfaceNode- Throws:
DOMException
-
getTextContent
public String getTextContent() throws DOMException
- Specified by:
getTextContentin interfaceNode- Throws:
DOMException
-
setTextContent
public void setTextContent(String textContent) throws DOMException
- Specified by:
setTextContentin interfaceNode- Throws:
DOMException
-
isSameNode
public boolean isSameNode(Node other)
- Specified by:
isSameNodein interfaceNode
-
lookupPrefix
public String lookupPrefix(String namespaceURI)
- Specified by:
lookupPrefixin interfaceNode
-
isDefaultNamespace
public boolean isDefaultNamespace(String namespaceURI)
- Specified by:
isDefaultNamespacein interfaceNode
-
lookupNamespaceURI
public String lookupNamespaceURI(String prefix)
- Specified by:
lookupNamespaceURIin interfaceNode
-
isEqualNode
public boolean isEqualNode(Node arg)
- Specified by:
isEqualNodein interfaceNode
-
getFeature
public Object getFeature(String feature, String version)
- Specified by:
getFeaturein interfaceNode
-
setUserData
public Object setUserData(String key, Object data, UserDataHandler handler)
- Specified by:
setUserDatain interfaceNode
-
getUserData
public Object getUserData(String key)
- Specified by:
getUserDatain interfaceNode
-
getDomDocument
public Document getDomDocument()
-
register
public void register(Node node)
Insert a mapping information forNode-Node. In SAAJ, elements in DOM are expected to be interfaces of SAAJ, on the other hand in JDKs Xerces, they are casted to internal impl classes. After removal of SAAJ dependency to JDKs internal classes elements in DOM can never be both of them.- Parameters:
node- SAAJ wrapper node for w3c DOM node
-
find
public Node find(Node node)
Find a soap wrapper for w3c dom node.- Parameters:
node- w3c dom node nullable- Returns:
- soap wrapper for w3c dom node
-
findIfPresent
public Node findIfPresent(Node node)
If corresponding soap wrapper exists for w3c dom node it is returned, if not passed dom element is returned.- Parameters:
node- w3c dom node- Returns:
- soap wrapper or passed w3c dom node if not found
-
getDomNode
public Node getDomNode(Node node)
Extracts w3c dom node from corresponding soap wrapper.- Parameters:
node- soap or dom nullable- Returns:
- dom node
-
getDomElement
public Document getDomElement()
-
getValue
public String getValue()
Description copied from interface:NodeReturns the value of this node if this is aTextnode or the value of the immediate child of this node otherwise. If there is an immediate child of thisNodethat it is aTextnode then it's value will be returned. If there is more than oneTextnode then the value of the firstTextNode will be returned. Otherwisenullis returned.
-
setValue
public void setValue(String value)
Description copied from interface:NodeIf this is a Text node then this method will set its value, otherwise it sets the value of the immediate (Text) child of this node. The value of the immediate child of this node can be set only if, there is one child node and that node is aTextnode, or if there are no children in which case a childTextnode will be created.
-
setParentElement
public void setParentElement(SOAPElement parent) throws SOAPException
Description copied from interface:NodeSets the parent of thisNodeobject to the givenSOAPElementobject.- Specified by:
setParentElementin interfaceNode- Parameters:
parent- theSOAPElementobject to be set as the parent of thisNodeobject- Throws:
SOAPException- if there is a problem in setting the parent to the given element- See Also:
Node.getParentElement()
-
getParentElement
public SOAPElement getParentElement()
Description copied from interface:NodeReturns the parent element of thisNodeobject. This method can throw anUnsupportedOperationExceptionif the tree is not kept in memory.- Specified by:
getParentElementin interfaceNode- Returns:
- the
SOAPElementobject that is the parent of thisNodeobject ornullif thisNodeobject is root - See Also:
Node.setParentElement(jakarta.xml.soap.SOAPElement)
-
detachNode
public void detachNode()
Description copied from interface:NodeRemoves thisNodeobject from the tree.- Specified by:
detachNodein interfaceNode
-
recycleNode
public void recycleNode()
Description copied from interface:NodeNotifies the implementation that thisNodeobject is no longer being used by the application and that the implementation is free to reuse this object for nodes that may be created later.Calling the method
recycleNodeimplies that the methoddetachNodehas been called previously.- Specified by:
recycleNodein interfaceNode
-
-