soapelementimpl.java
来自「开源的axis2框架的源码。用于开发WEBSERVER」· Java 代码 · 共 852 行 · 第 1/3 页
JAVA
852 行
throw new SOAPException("EncodingStyle attribute cannot appear in : " + this);
}
}
}
/* (non-Javadoc)
* @see org.apache.axiom.om.impl.OMNodeEx#setParent(org.apache.axiom.om.OMContainer)
*/
public void setParent(OMContainer parentElement) {
element.setParent(parentElement);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#getAttribute(java.lang.String)
*/
public String getAttribute(String name) {
return element.getAttribute(name);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#getAttributeNode(java.lang.String)
*/
public Attr getAttributeNode(String name) {
return element.getAttributeNode(name);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#getAttributeNodeNS(java.lang.String, java.lang.String)
*/
public Attr getAttributeNodeNS(String namespaceURI, String localName) {
return element.getAttributeNodeNS(namespaceURI, localName);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#getAttributeNS(java.lang.String, java.lang.String)
*/
public String getAttributeNS(String namespaceURI, String localName) {
return element.getAttributeNS(namespaceURI, localName);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#getElementsByTagName(java.lang.String)
*/
public NodeList getElementsByTagName(String name) {
return element.getElementsByTagName(name);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#getElementsByTagNameNS(java.lang.String, java.lang.String)
*/
public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
return element.getElementsByTagNameNS(namespaceURI, localName);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#getTagName()
*/
public String getTagName() {
return element.getTagName();
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#hasAttribute(java.lang.String)
*/
public boolean hasAttribute(String name) {
return element.hasAttribute(name);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#hasAttributeNS(java.lang.String, java.lang.String)
*/
public boolean hasAttributeNS(String namespaceURI, String localName) {
return element.hasAttributeNS(namespaceURI, localName);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#removeAttribute(java.lang.String)
*/
public void removeAttribute(String name) throws DOMException {
element.removeAttribute(name);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr)
*/
public Attr removeAttributeNode(Attr attr) throws DOMException {
return element.removeAttributeNode(attr);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#removeAttributeNS(java.lang.String, java.lang.String)
*/
public void removeAttributeNS(String namespaceURI, String localName) throws DOMException {
element.removeAttributeNS(namespaceURI, localName);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#setAttribute(java.lang.String, java.lang.String)
*/
public void setAttribute(String name, String value) throws DOMException {
element.setAttribute(name, value);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#setAttributeNode(org.w3c.dom.Attr)
*/
public Attr setAttributeNode(Attr attr) throws DOMException {
return element.setAttributeNode(attr);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#setAttributeNodeNS(org.w3c.dom.Attr)
*/
public Attr setAttributeNodeNS(Attr attr) throws DOMException {
return element.setAttributeNodeNS(attr);
}
/* (non-Javadoc)
* @see org.w3c.dom.Element#setAttributeNS(java.lang.String, java.lang.String, java.lang.String)
*/
public void setAttributeNS(String namespaceURI,
String qualifiedName, String value) throws DOMException {
element.setAttributeNS(namespaceURI, qualifiedName, value);
}
/* (non-Javadoc)
* @see org.w3c.dom.Node#getNodeName()
*/
public String getNodeName() {
return element.getNodeName();
}
/* (non-Javadoc)
* @see org.w3c.dom.Node#getNodeType()
*/
public short getNodeType() {
return Node.ELEMENT_NODE;
}
public ElementImpl getElement() {
return element;
}
/**
* Returns the parent element of this <code>Node</code> object. This method can throw an
* <code>UnsupportedOperationException</code> if the tree is not kept in memory.
*
* @return the <code>SOAPElement</code> object that is the parent of this <code>Node</code>
* object or <code>null</code> if this <code>Node</code> object is root
* @throws UnsupportedOperationException if the whole tree is not kept in memory
* @see #setParentElement(javax.xml.soap.SOAPElement) setParentElement(javax.xml.soap.SOAPElement)
*/
public SOAPElement getParentElement() {
if (this.parentElement == null) {
return (SOAPElement)toSAAJNode(element.getParentNode());
}
return this.parentElement;
}
public void setParentElement(SOAPElement parent) throws SOAPException {
this.parentElement = parent;
this.element.setParent(((SOAPElementImpl)parent).element);
}
/**
* Find the Document that this Node belongs to (the document in whose context the Node was
* created). The Node may or may not
*/
public Document getOwnerDocument() {
return element.getOwnerDocument();
}
/**
* Returns the the value of the immediate child of this <code>Node</code> object if a child
* exists and its value is text.
*
* @return a <code>String</code> with the text of the immediate child of this <code>Node</code>
* object if (1) there is a child and (2) the child is a <code>Text</code> object;
* <code>null</code> otherwise
*/
public String getValue() {
if (element.getType() == OMNode.TEXT_NODE) {
return element.getText();
} else if (element.getType() == OMNode.ELEMENT_NODE) {
final OMNode firstOMChild = element.getFirstOMChild();
if (firstOMChild instanceof TextImpl) {
return ((TextImpl)firstOMChild).getData();
} else if (firstOMChild instanceof SOAPElementImpl) {
return ((SOAPElementImpl)firstOMChild).getValue();
}
}
return null;
}
public org.w3c.dom.Node getFirstChild() {
return toSAAJNode(element.getFirstChild());
}
/**
* Method getLastChild
*
* @see org.w3c.dom.Node#getLastChild()
*/
public org.w3c.dom.Node getLastChild() {
return toSAAJNode(element.getLastChild());
}
public Node getParentNode() {
return getParentElement();
}
/** dom Node method */
public org.w3c.dom.Node getNextSibling() {
return toSAAJNode(element.getNextSibling());
}
public Node getPreviousSibling() {
return toSAAJNode(element.getPreviousSibling());
}
public NodeList getChildNodes() {
NodeList childNodes = element.getChildNodes();
NodeListImpl nodes = new NodeListImpl();
for (int i = 0; i < childNodes.getLength(); i++) {
nodes.addNode(toSAAJNode(childNodes.item(i)));
}
return nodes;
}
public boolean hasChildNodes() {
return element.hasChildNodes();
}
/**
* 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. The value of the immediate child of this node can be
* set only if, there is one child node and that node is a Text node, or if there are no
* children in which case a child Text node will be created.
*
* @param value the text to set
* @throws IllegalStateException if the node is not a Text node and either has more than one
* child node or has a child node that is not a Text node
*/
public void setValue(String value) {
OMNode firstChild = element.getFirstOMChild();
if (firstChild == null) {
try {
this.addTextNode(value);
} catch (SOAPException e) {
throw new RuntimeException("Cannot add text node", e);
}
} else if (((org.w3c.dom.Node)firstChild).getNodeType() == javax.xml.soap.Node.TEXT_NODE
&& firstChild.getNextOMSibling() == null) {
((org.w3c.dom.Text)firstChild).setData(value);
} else {
throw new IllegalStateException("This node is not a Text node and " +
"either has more than one child node or has a child " +
"node that is not a Text node");
}
}
public void detachNode() {
this.detach();
}
public OMNode detach() {
OMNode omNode = this.element.detach();
this.parentElement = null;
return omNode;
}
/**
* Returns the collection of attributes associated with this node, or null if none. At this
* writing, Element is the only type of node which will ever have attributes.
*
* @see org.apache.axiom.om.impl.dom.ElementImpl
*/
public NamedNodeMap getAttributes() {
return element.getAttributes();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?