< prev index next >

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

Print this page

        

*** 106,116 **** return element.removeAttributeNode(oldAttr); } @Override public NodeList getElementsByTagName(String name) { ! return new NodeListImpl(getSoapDocument(), element.getElementsByTagName(name)); } @Override public String getAttributeNS(String namespaceURI, String localName) throws DOMException { return element.getAttributeNS(namespaceURI, localName); --- 106,116 ---- return element.removeAttributeNode(oldAttr); } @Override public NodeList getElementsByTagName(String name) { ! return new NodeListImpl(soapDocument, element.getElementsByTagName(name)); } @Override public String getAttributeNS(String namespaceURI, String localName) throws DOMException { return element.getAttributeNS(namespaceURI, localName);
*** 137,161 **** 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); } public ElementImpl(SOAPDocumentImpl ownerDoc, QName name) { this.soapDocument = ownerDoc; this.element = ownerDoc.getDomDocument().createElementNS(name.getNamespaceURI(), getQualifiedName(name)); elementQName = name; ! getSoapDocument().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); } public ElementImpl( SOAPDocumentImpl ownerDoc, String uri, --- 137,161 ---- public ElementImpl(SOAPDocumentImpl ownerDoc, Name name) { this.soapDocument = ownerDoc; this.element = ownerDoc.getDomDocument().createElementNS(name.getURI(), name.getQualifiedName()); elementQName = NameImpl.convertToQName(name); ! soapDocument.register(this); } public ElementImpl(SOAPDocumentImpl ownerDoc, QName name) { this.soapDocument = ownerDoc; this.element = ownerDoc.getDomDocument().createElementNS(name.getNamespaceURI(), getQualifiedName(name)); elementQName = name; ! soapDocument.register(this); } public ElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) { this.element = domElement; this.soapDocument = ownerDoc; this.elementQName = new QName(domElement.getNamespaceURI(), domElement.getLocalName()); ! soapDocument.register(this); } public ElementImpl( SOAPDocumentImpl ownerDoc, String uri,
*** 163,173 **** this.soapDocument = ownerDoc; this.element = ownerDoc.getDomDocument().createElementNS(uri, qualifiedName); elementQName = new QName(uri, getLocalPart(qualifiedName), getPrefix(qualifiedName)); ! getSoapDocument().register(this); } public void ensureNamespaceIsDeclared(String prefix, String uri) { String alreadyDeclaredUri = getNamespaceURI(prefix); if (alreadyDeclaredUri == null || !alreadyDeclaredUri.equals(uri)) { --- 163,173 ---- this.soapDocument = ownerDoc; this.element = ownerDoc.getDomDocument().createElementNS(uri, qualifiedName); elementQName = new QName(uri, getLocalPart(qualifiedName), getPrefix(qualifiedName)); ! soapDocument.register(this); } public void ensureNamespaceIsDeclared(String prefix, String uri) { String alreadyDeclaredUri = getNamespaceURI(prefix); if (alreadyDeclaredUri == null || !alreadyDeclaredUri.equals(uri)) {
*** 182,207 **** return soapDocument; } @Override public Node insertBefore(Node newChild, Node refChild) throws DOMException { ! return element.insertBefore(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(refChild)); } @Override public Node replaceChild(Node newChild, Node oldChild) throws DOMException { ! return element.replaceChild(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(oldChild)); } @Override public Node removeChild(Node oldChild) throws DOMException { ! return element.removeChild(getSoapDocument().getDomNode(oldChild)); } @Override public Node appendChild(Node newChild) throws DOMException { ! return element.appendChild(getSoapDocument().getDomNode(newChild)); } @Override public boolean hasChildNodes() { return element.hasChildNodes(); --- 182,207 ---- return soapDocument; } @Override public Node insertBefore(Node newChild, Node refChild) throws DOMException { ! return soapDocument.findIfPresent(element.insertBefore(soapDocument.getDomNode(newChild), soapDocument.getDomNode(refChild))); } @Override public Node replaceChild(Node newChild, Node oldChild) throws DOMException { ! return soapDocument.findIfPresent(element.replaceChild(soapDocument.getDomNode(newChild), soapDocument.getDomNode(oldChild))); } @Override public Node removeChild(Node oldChild) throws DOMException { ! return soapDocument.findIfPresent(element.removeChild(soapDocument.getDomNode(oldChild))); } @Override public Node appendChild(Node newChild) throws DOMException { ! return soapDocument.findIfPresent(element.appendChild(soapDocument.getDomNode(newChild))); } @Override public boolean hasChildNodes() { return element.hasChildNodes();
*** 601,611 **** getOwnerDocument().createElement(getQualifiedName(name)); } } protected void addNode(org.w3c.dom.Node newElement) throws SOAPException { ! insertBefore(getSoapDocument().getDomNode(newElement), null); if (getOwnerDocument() instanceof DocumentFragment) return; if (newElement instanceof ElementImpl) { --- 601,611 ---- getOwnerDocument().createElement(getQualifiedName(name)); } } protected void addNode(org.w3c.dom.Node newElement) throws SOAPException { ! insertBefore(soapDocument.getDomNode(newElement), null); if (getOwnerDocument() instanceof DocumentFragment) return; if (newElement instanceof ElementImpl) {
*** 621,642 **** Element getFirstChildElement() { Node child = getFirstChild(); while (child != null) { if (child instanceof Element) { ! return (Element) getSoapDocument().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); if (eachChildSoap != null) { if (eachChildSoap.getElementName().equals(name)) { return eachChildSoap; } } --- 621,642 ---- Element getFirstChildElement() { Node child = getFirstChild(); while (child != null) { if (child instanceof Element) { ! 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) soapDocument.find(eachChild); if (eachChildSoap != null) { if (eachChildSoap.getElementName().equals(name)) { return eachChildSoap; } }
*** 876,886 **** public Iterator<Node> getChildElements() { return getChildElementsFrom(this); } protected SOAPElement convertToSoapElement(Element element) { ! final Node soapNode = getSoapDocument().findIfPresent(element); if (soapNode instanceof SOAPElement) { return (SOAPElement) soapNode; } else { return replaceElementWithSOAPElement( element, --- 876,886 ---- public Iterator<Node> getChildElements() { return getChildElementsFrom(this); } protected SOAPElement convertToSoapElement(Element element) { ! final Node soapNode = soapDocument.findIfPresent(element); if (soapNode instanceof SOAPElement) { return (SOAPElement) soapNode; } else { return replaceElementWithSOAPElement( element,
*** 902,912 **** while (eachChild.hasNext()) { Node nextChild = eachChild.next(); copy.insertBefore(nextChild, null); } ! Node parent = getSoapDocument().find(element.getParentNode()); if (parent != null) { parent.replaceChild(copy, element); } // XXX else throw an exception? return copy; --- 902,912 ---- while (eachChild.hasNext()) { Node nextChild = eachChild.next(); copy.insertBefore(nextChild, null); } ! Node parent = soapDocument.find(element.getParentNode()); if (parent != null) { parent.replaceChild(copy, element); } // XXX else throw an exception? return copy;
*** 921,931 **** public boolean hasNext() { if (next == null) { while (eachNode.hasNext()) { Node node = eachNode.next(); if (node instanceof Element) { ! next = getSoapDocument().findIfPresent(node); break; } } } return next != null; --- 921,931 ---- public boolean hasNext() { if (next == null) { while (eachNode.hasNext()) { Node node = eachNode.next(); if (node instanceof Element) { ! next = soapDocument.findIfPresent(node); break; } } } return next != null;
*** 1099,1109 **** 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 null; } --- 1099,1109 ---- 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 soapDocument.find(n); } } return null; }
*** 1141,1151 **** public SOAPElement getParentElement() { Node parentNode = getParentNode(); if (parentNode instanceof SOAPDocument) { return null; } ! return (SOAPElement) getSoapDocument().find(parentNode); } protected String getSOAPNamespace() { String soapNamespace = null; --- 1141,1151 ---- public SOAPElement getParentElement() { Node parentNode = getParentNode(); if (parentNode instanceof SOAPDocument) { return null; } ! return (SOAPElement) soapDocument.find(parentNode); } protected String getSOAPNamespace() { String soapNamespace = null;
*** 1334,1344 **** 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); public boolean hasNext() { if (next != null) { return true; } --- 1334,1344 ---- protected Iterator<Node> getChildElementsFrom(final Element element) { return new Iterator<Node>() { Node next = element.getFirstChild(); Node nextNext = null; Node last = null; ! Node soapElement = soapDocument.findIfPresent(element); public boolean hasNext() { if (next != null) { return true; }
*** 1360,1370 **** ((ElementImpl) soapElement).convertToSoapElement( (Element) last); } nextNext = last.getNextSibling(); ! return getSoapDocument().findIfPresent(last); } throw new NoSuchElementException(); } public void remove() { --- 1360,1370 ---- ((ElementImpl) soapElement).convertToSoapElement( (Element) last); } nextNext = last.getNextSibling(); ! return soapDocument.findIfPresent(last); } throw new NoSuchElementException(); } public void remove() {
*** 1481,1491 **** return element.setAttributeNodeNS(newAttr); } @Override public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException { ! return new NodeListImpl(getSoapDocument(), element.getElementsByTagNameNS(namespaceURI, localName)); } @Override public boolean hasAttribute(String name) { return element.hasAttribute(name); --- 1481,1491 ---- return element.setAttributeNodeNS(newAttr); } @Override public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException { ! return new NodeListImpl(soapDocument, element.getElementsByTagNameNS(namespaceURI, localName)); } @Override public boolean hasAttribute(String name) { return element.hasAttribute(name);
*** 1536,1576 **** return element.getNodeType(); } @Override public Node getParentNode() { ! return getSoapDocument().find(element.getParentNode()); } @Override public NodeList getChildNodes() { ! return new NodeListImpl(getSoapDocument(), element.getChildNodes()); } @Override public Node getFirstChild() { ! return getSoapDocument().findIfPresent(element.getFirstChild()); } @Override public Node getLastChild() { ! return getSoapDocument().findIfPresent(element.getLastChild()); } @Override public Node getPreviousSibling() { ! return getSoapDocument().findIfPresent(element.getPreviousSibling()); } @Override public Node getNextSibling() { ! return getSoapDocument().findIfPresent(element.getNextSibling()); } @Override public NamedNodeMap getAttributes() { ! return element.getAttributes(); } public Element getDomElement() { return element; } --- 1536,1576 ---- return element.getNodeType(); } @Override public Node getParentNode() { ! return soapDocument.find(element.getParentNode()); } @Override public NodeList getChildNodes() { ! return new NodeListImpl(soapDocument, element.getChildNodes()); } @Override public Node getFirstChild() { ! return soapDocument.findIfPresent(element.getFirstChild()); } @Override public Node getLastChild() { ! return soapDocument.findIfPresent(element.getLastChild()); } @Override public Node getPreviousSibling() { ! return soapDocument.findIfPresent(element.getPreviousSibling()); } @Override public Node getNextSibling() { ! return soapDocument.findIfPresent(element.getNextSibling()); } @Override public NamedNodeMap getAttributes() { ! return new NamedNodeMapImpl(element.getAttributes(), soapDocument); } public Element getDomElement() { return element; }
< prev index next >