< prev index next >

jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java

Print this page

        

@@ -106,11 +106,11 @@
         return element.removeAttributeNode(oldAttr);
     }
 
     @Override
     public NodeList getElementsByTagName(String name) {
-        return new NodeListImpl(getSoapDocument(), element.getElementsByTagName(name));
+        return new NodeListImpl(soapDocument, element.getElementsByTagName(name));
     }
 
     @Override
     public String getAttributeNS(String namespaceURI, String localName) throws DOMException {
         return element.getAttributeNS(namespaceURI, localName);

@@ -137,25 +137,25 @@
 
     public ElementImpl(SOAPDocumentImpl ownerDoc, Name name) {
         this.soapDocument = ownerDoc;
         this.element = ownerDoc.getDomDocument().createElementNS(name.getURI(), name.getQualifiedName());
         elementQName = NameImpl.convertToQName(name);
-        getSoapDocument().register(this);
+        soapDocument.register(this);
     }
 
     public ElementImpl(SOAPDocumentImpl ownerDoc, QName name) {
         this.soapDocument = ownerDoc;
         this.element = ownerDoc.getDomDocument().createElementNS(name.getNamespaceURI(), getQualifiedName(name));
         elementQName = name;
-        getSoapDocument().register(this);
+        soapDocument.register(this);
     }
 
     public ElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
         this.element = domElement;
         this.soapDocument = ownerDoc;
         this.elementQName = new QName(domElement.getNamespaceURI(), domElement.getLocalName());
-        getSoapDocument().register(this);
+        soapDocument.register(this);
     }
 
     public ElementImpl(
         SOAPDocumentImpl ownerDoc,
         String uri,

@@ -163,11 +163,11 @@
 
         this.soapDocument = ownerDoc;
         this.element = ownerDoc.getDomDocument().createElementNS(uri, qualifiedName);
         elementQName =
             new QName(uri, getLocalPart(qualifiedName), getPrefix(qualifiedName));
-        getSoapDocument().register(this);
+        soapDocument.register(this);
     }
 
     public void ensureNamespaceIsDeclared(String prefix, String uri) {
         String alreadyDeclaredUri = getNamespaceURI(prefix);
         if (alreadyDeclaredUri == null || !alreadyDeclaredUri.equals(uri)) {

@@ -182,26 +182,26 @@
         return soapDocument;
     }
 
     @Override
     public Node insertBefore(Node newChild, Node refChild) throws DOMException {
-        return element.insertBefore(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(refChild));
+        return soapDocument.findIfPresent(element.insertBefore(soapDocument.getDomNode(newChild), soapDocument.getDomNode(refChild)));
     }
 
     @Override
     public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
-        return element.replaceChild(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(oldChild));
+        return soapDocument.findIfPresent(element.replaceChild(soapDocument.getDomNode(newChild), soapDocument.getDomNode(oldChild)));
     }
 
     @Override
     public Node removeChild(Node oldChild) throws DOMException {
-        return element.removeChild(getSoapDocument().getDomNode(oldChild));
+        return soapDocument.findIfPresent(element.removeChild(soapDocument.getDomNode(oldChild)));
     }
 
     @Override
     public Node appendChild(Node newChild) throws DOMException {
-        return element.appendChild(getSoapDocument().getDomNode(newChild));
+        return soapDocument.findIfPresent(element.appendChild(soapDocument.getDomNode(newChild)));
     }
 
     @Override
     public boolean hasChildNodes() {
         return element.hasChildNodes();

@@ -601,11 +601,11 @@
                 getOwnerDocument().createElement(getQualifiedName(name));
         }
     }
 
     protected void addNode(org.w3c.dom.Node newElement) throws SOAPException {
-        insertBefore(getSoapDocument().getDomNode(newElement), null);
+        insertBefore(soapDocument.getDomNode(newElement), null);
 
         if (getOwnerDocument() instanceof DocumentFragment)
             return;
 
         if (newElement instanceof ElementImpl) {

@@ -621,22 +621,22 @@
 
     Element getFirstChildElement() {
         Node child = getFirstChild();
         while (child != null) {
             if (child instanceof Element) {
-                return (Element) getSoapDocument().find(child);
+                return (Element) soapDocument.find(child);
             }
             child = child.getNextSibling();
         }
         return null;
     }
 
     protected SOAPElement findChild(NameImpl name) {
         Node eachChild = getFirstChild();
         while (eachChild != null) {
             if (eachChild instanceof Element) {
-                SOAPElement eachChildSoap = (SOAPElement) getSoapDocument().find(eachChild);
+                SOAPElement eachChildSoap = (SOAPElement) soapDocument.find(eachChild);
                 if (eachChildSoap != null) {
                     if (eachChildSoap.getElementName().equals(name)) {
                         return eachChildSoap;
                     }
                 }

@@ -876,11 +876,11 @@
     public Iterator<Node> getChildElements() {
         return getChildElementsFrom(this);
     }
 
     protected SOAPElement convertToSoapElement(Element element) {
-        final Node soapNode = getSoapDocument().findIfPresent(element);
+        final Node soapNode = soapDocument.findIfPresent(element);
         if (soapNode instanceof SOAPElement) {
             return (SOAPElement) soapNode;
         } else {
             return replaceElementWithSOAPElement(
                 element,

@@ -902,11 +902,11 @@
         while (eachChild.hasNext()) {
             Node nextChild = eachChild.next();
             copy.insertBefore(nextChild, null);
         }
 
-        Node parent = getSoapDocument().find(element.getParentNode());
+        Node parent = soapDocument.find(element.getParentNode());
         if (parent != null) {
             parent.replaceChild(copy, element);
         } // XXX else throw an exception?
 
         return copy;

@@ -921,11 +921,11 @@
             public boolean hasNext() {
                 if (next == null) {
                     while (eachNode.hasNext()) {
                         Node node = eachNode.next();
                         if (node instanceof Element) {
-                            next = getSoapDocument().findIfPresent(node);
+                            next = soapDocument.findIfPresent(node);
                             break;
                         }
                     }
                 }
                 return next != null;

@@ -1099,11 +1099,11 @@
                 n.getNodeType() == org.w3c.dom.Node.CDATA_SECTION_NODE) {
                 // TODO: Hack to fix text node split into multiple lines.
                 normalize();
                 // Should remove the normalization step when this gets fixed in
                 // DOM/Xerces.
-                return getSoapDocument().find(n);
+                return soapDocument.find(n);
             }
         }
         return null;
     }
 

@@ -1141,11 +1141,11 @@
     public SOAPElement getParentElement() {
         Node parentNode = getParentNode();
         if (parentNode instanceof SOAPDocument) {
             return null;
         }
-        return (SOAPElement) getSoapDocument().find(parentNode);
+        return (SOAPElement) soapDocument.find(parentNode);
     }
 
     protected String getSOAPNamespace() {
         String soapNamespace = null;
 

@@ -1334,11 +1334,11 @@
     protected Iterator<Node> getChildElementsFrom(final Element element) {
         return new Iterator<Node>() {
             Node next = element.getFirstChild();
             Node nextNext = null;
             Node last = null;
-            Node soapElement = getSoapDocument().findIfPresent(element);
+            Node soapElement = soapDocument.findIfPresent(element);
 
             public boolean hasNext() {
                 if (next != null) {
                     return true;
                 }

@@ -1360,11 +1360,11 @@
                                 ((ElementImpl) soapElement).convertToSoapElement(
                                         (Element) last);
                     }
 
                     nextNext = last.getNextSibling();
-                    return getSoapDocument().findIfPresent(last);
+                    return soapDocument.findIfPresent(last);
                 }
                 throw new NoSuchElementException();
             }
 
             public void remove() {

@@ -1481,11 +1481,11 @@
         return element.setAttributeNodeNS(newAttr);
     }
 
     @Override
     public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException {
-        return new NodeListImpl(getSoapDocument(), element.getElementsByTagNameNS(namespaceURI, localName));
+        return new NodeListImpl(soapDocument, element.getElementsByTagNameNS(namespaceURI, localName));
     }
 
     @Override
     public boolean hasAttribute(String name) {
         return element.hasAttribute(name);

@@ -1536,41 +1536,41 @@
         return element.getNodeType();
     }
 
     @Override
     public Node getParentNode() {
-        return getSoapDocument().find(element.getParentNode());
+        return soapDocument.find(element.getParentNode());
     }
 
     @Override
     public NodeList getChildNodes() {
-        return new NodeListImpl(getSoapDocument(), element.getChildNodes());
+        return new NodeListImpl(soapDocument, element.getChildNodes());
     }
 
     @Override
     public Node getFirstChild() {
-        return getSoapDocument().findIfPresent(element.getFirstChild());
+        return soapDocument.findIfPresent(element.getFirstChild());
     }
 
     @Override
     public Node getLastChild() {
-        return getSoapDocument().findIfPresent(element.getLastChild());
+        return soapDocument.findIfPresent(element.getLastChild());
     }
 
     @Override
     public Node getPreviousSibling() {
-        return getSoapDocument().findIfPresent(element.getPreviousSibling());
+        return soapDocument.findIfPresent(element.getPreviousSibling());
     }
 
     @Override
     public Node getNextSibling() {
-        return getSoapDocument().findIfPresent(element.getNextSibling());
+        return soapDocument.findIfPresent(element.getNextSibling());
     }
 
     @Override
     public NamedNodeMap getAttributes() {
-        return element.getAttributes();
+        return new NamedNodeMapImpl(element.getAttributes(), soapDocument);
     }
 
     public Element getDomElement() {
         return element;
     }
< prev index next >