Thu, 31 Aug 2017 15:18:52 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package com.sun.xml.internal.messaging.saaj.soap.impl; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import java.net.URI; |
aoqi@0 | 29 | import java.net.URISyntaxException; |
aoqi@0 | 30 | import java.util.*; |
aoqi@0 | 31 | import java.util.logging.Level; |
aoqi@0 | 32 | import java.util.logging.Logger; |
aoqi@0 | 33 | |
aoqi@0 | 34 | import javax.xml.namespace.QName; |
aoqi@0 | 35 | import javax.xml.soap.*; |
aoqi@0 | 36 | |
aoqi@0 | 37 | import org.w3c.dom.*; |
aoqi@0 | 38 | import org.w3c.dom.Node; |
aoqi@0 | 39 | |
aoqi@0 | 40 | import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; |
aoqi@0 | 41 | import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument; |
aoqi@0 | 42 | import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; |
aoqi@0 | 43 | import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl; |
aoqi@0 | 44 | import com.sun.xml.internal.messaging.saaj.util.*; |
aoqi@0 | 45 | |
aoqi@0 | 46 | public class ElementImpl |
aoqi@0 | 47 | extends com.sun.org.apache.xerces.internal.dom.ElementNSImpl |
aoqi@0 | 48 | implements SOAPElement, SOAPBodyElement { |
aoqi@0 | 49 | |
aoqi@0 | 50 | public static final String DSIG_NS = "http://www.w3.org/2000/09/xmldsig#".intern(); |
aoqi@0 | 51 | public static final String XENC_NS = "http://www.w3.org/2001/04/xmlenc#".intern(); |
aoqi@0 | 52 | public static final String WSU_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd".intern(); |
aoqi@0 | 53 | |
aoqi@0 | 54 | private AttributeManager encodingStyleAttribute = new AttributeManager(); |
aoqi@0 | 55 | |
aoqi@0 | 56 | protected QName elementQName; |
aoqi@0 | 57 | |
aoqi@0 | 58 | protected static final Logger log = |
aoqi@0 | 59 | Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN, |
aoqi@0 | 60 | "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings"); |
aoqi@0 | 61 | |
aoqi@0 | 62 | /** |
aoqi@0 | 63 | * XML Information Set REC |
aoqi@0 | 64 | * all namespace attributes (including those named xmlns, |
aoqi@0 | 65 | * whose [prefix] property has no value) have a namespace URI of http://www.w3.org/2000/xmlns/ |
aoqi@0 | 66 | */ |
aoqi@0 | 67 | public final static String XMLNS_URI = "http://www.w3.org/2000/xmlns/".intern(); |
aoqi@0 | 68 | |
aoqi@0 | 69 | /** |
aoqi@0 | 70 | * The XML Namespace ("http://www.w3.org/XML/1998/namespace"). This is |
aoqi@0 | 71 | * the Namespace URI that is automatically mapped to the "xml" prefix. |
aoqi@0 | 72 | */ |
aoqi@0 | 73 | public final static String XML_URI = "http://www.w3.org/XML/1998/namespace".intern(); |
aoqi@0 | 74 | |
aoqi@0 | 75 | public ElementImpl(SOAPDocumentImpl ownerDoc, Name name) { |
aoqi@0 | 76 | super( |
aoqi@0 | 77 | ownerDoc, |
aoqi@0 | 78 | name.getURI(), |
aoqi@0 | 79 | name.getQualifiedName(), |
aoqi@0 | 80 | name.getLocalName()); |
aoqi@0 | 81 | elementQName = NameImpl.convertToQName(name); |
aoqi@0 | 82 | } |
aoqi@0 | 83 | |
aoqi@0 | 84 | public ElementImpl(SOAPDocumentImpl ownerDoc, QName name) { |
aoqi@0 | 85 | super( |
aoqi@0 | 86 | ownerDoc, |
aoqi@0 | 87 | name.getNamespaceURI(), |
aoqi@0 | 88 | getQualifiedName(name), |
aoqi@0 | 89 | name.getLocalPart()); |
aoqi@0 | 90 | elementQName = name; |
aoqi@0 | 91 | } |
aoqi@0 | 92 | |
aoqi@0 | 93 | public ElementImpl( |
aoqi@0 | 94 | SOAPDocumentImpl ownerDoc, |
aoqi@0 | 95 | String uri, |
aoqi@0 | 96 | String qualifiedName) { |
aoqi@0 | 97 | |
aoqi@0 | 98 | super(ownerDoc, uri, qualifiedName); |
aoqi@0 | 99 | elementQName = |
aoqi@0 | 100 | new QName(uri, getLocalPart(qualifiedName), getPrefix(qualifiedName)); |
aoqi@0 | 101 | } |
aoqi@0 | 102 | |
aoqi@0 | 103 | public void ensureNamespaceIsDeclared(String prefix, String uri) { |
aoqi@0 | 104 | String alreadyDeclaredUri = getNamespaceURI(prefix); |
aoqi@0 | 105 | if (alreadyDeclaredUri == null || !alreadyDeclaredUri.equals(uri)) { |
aoqi@0 | 106 | try { |
aoqi@0 | 107 | addNamespaceDeclaration(prefix, uri); |
aoqi@0 | 108 | } catch (SOAPException e) { /*ignore*/ |
aoqi@0 | 109 | } |
aoqi@0 | 110 | } |
aoqi@0 | 111 | } |
aoqi@0 | 112 | |
aoqi@0 | 113 | public Document getOwnerDocument() { |
aoqi@0 | 114 | Document doc = super.getOwnerDocument(); |
aoqi@0 | 115 | if (doc instanceof SOAPDocument) |
aoqi@0 | 116 | return ((SOAPDocument) doc).getDocument(); |
aoqi@0 | 117 | else |
aoqi@0 | 118 | return doc; |
aoqi@0 | 119 | } |
aoqi@0 | 120 | |
aoqi@0 | 121 | public SOAPElement addChildElement(Name name) throws SOAPException { |
aoqi@0 | 122 | return addElement(name); |
aoqi@0 | 123 | } |
aoqi@0 | 124 | |
aoqi@0 | 125 | public SOAPElement addChildElement(QName qname) throws SOAPException { |
aoqi@0 | 126 | return addElement(qname); |
aoqi@0 | 127 | } |
aoqi@0 | 128 | |
aoqi@0 | 129 | public SOAPElement addChildElement(String localName) throws SOAPException { |
aoqi@0 | 130 | return (SOAPElement) addChildElement( |
aoqi@0 | 131 | NameImpl.createFromUnqualifiedName(localName)); |
aoqi@0 | 132 | } |
aoqi@0 | 133 | |
aoqi@0 | 134 | public SOAPElement addChildElement(String localName, String prefix) |
aoqi@0 | 135 | throws SOAPException { |
aoqi@0 | 136 | String uri = getNamespaceURI(prefix); |
aoqi@0 | 137 | if (uri == null) { |
aoqi@0 | 138 | log.log( |
aoqi@0 | 139 | Level.SEVERE, |
aoqi@0 | 140 | "SAAJ0101.impl.parent.of.body.elem.mustbe.body", |
aoqi@0 | 141 | new String[] { prefix }); |
aoqi@0 | 142 | throw new SOAPExceptionImpl( |
aoqi@0 | 143 | "Unable to locate namespace for prefix " + prefix); |
aoqi@0 | 144 | } |
aoqi@0 | 145 | return addChildElement(localName, prefix, uri); |
aoqi@0 | 146 | } |
aoqi@0 | 147 | |
aoqi@0 | 148 | public String getNamespaceURI(String prefix) { |
aoqi@0 | 149 | |
aoqi@0 | 150 | if ("xmlns".equals(prefix)) { |
aoqi@0 | 151 | return XMLNS_URI; |
aoqi@0 | 152 | } |
aoqi@0 | 153 | |
aoqi@0 | 154 | if("xml".equals(prefix)) { |
aoqi@0 | 155 | return XML_URI; |
aoqi@0 | 156 | } |
aoqi@0 | 157 | |
aoqi@0 | 158 | if ("".equals(prefix)) { |
aoqi@0 | 159 | |
aoqi@0 | 160 | org.w3c.dom.Node currentAncestor = this; |
aoqi@0 | 161 | while (currentAncestor != null && |
aoqi@0 | 162 | !(currentAncestor instanceof Document)) { |
aoqi@0 | 163 | |
aoqi@0 | 164 | if (currentAncestor instanceof ElementImpl) { |
aoqi@0 | 165 | QName name = ((ElementImpl) currentAncestor).getElementQName(); |
aoqi@0 | 166 | /* |
aoqi@0 | 167 | if (prefix.equals(name.getPrefix())) { |
aoqi@0 | 168 | String uri = name.getNamespaceURI(); |
aoqi@0 | 169 | if ("".equals(uri)) { |
aoqi@0 | 170 | return null; |
aoqi@0 | 171 | } |
aoqi@0 | 172 | else { |
aoqi@0 | 173 | return uri; |
aoqi@0 | 174 | } |
aoqi@0 | 175 | }*/ |
aoqi@0 | 176 | if (((Element) currentAncestor).hasAttributeNS( |
aoqi@0 | 177 | XMLNS_URI, "xmlns")) { |
aoqi@0 | 178 | |
aoqi@0 | 179 | String uri = |
aoqi@0 | 180 | ((Element) currentAncestor).getAttributeNS( |
aoqi@0 | 181 | XMLNS_URI, "xmlns"); |
aoqi@0 | 182 | if ("".equals(uri)) |
aoqi@0 | 183 | return null; |
aoqi@0 | 184 | else { |
aoqi@0 | 185 | return uri; |
aoqi@0 | 186 | } |
aoqi@0 | 187 | } |
aoqi@0 | 188 | } |
aoqi@0 | 189 | currentAncestor = currentAncestor.getParentNode(); |
aoqi@0 | 190 | } |
aoqi@0 | 191 | |
aoqi@0 | 192 | } else if (prefix != null) { |
aoqi@0 | 193 | // Find if there's an ancester whose name contains this prefix |
aoqi@0 | 194 | org.w3c.dom.Node currentAncestor = this; |
aoqi@0 | 195 | |
aoqi@0 | 196 | // String uri = currentAncestor.lookupNamespaceURI(prefix); |
aoqi@0 | 197 | // return uri; |
aoqi@0 | 198 | while (currentAncestor != null && |
aoqi@0 | 199 | !(currentAncestor instanceof Document)) { |
aoqi@0 | 200 | |
aoqi@0 | 201 | /* if (prefix.equals(currentAncestor.getPrefix())) { |
aoqi@0 | 202 | String uri = currentAncestor.getNamespaceURI(); |
aoqi@0 | 203 | // this is because the javadoc says getNamespaceURI() is not a computed value |
aoqi@0 | 204 | // and URI for a non-empty prefix cannot be null |
aoqi@0 | 205 | if (uri != null) |
aoqi@0 | 206 | return uri; |
aoqi@0 | 207 | }*/ |
aoqi@0 | 208 | //String uri = currentAncestor.lookupNamespaceURI(prefix); |
aoqi@0 | 209 | //if (uri != null) { |
aoqi@0 | 210 | // return uri; |
aoqi@0 | 211 | //} |
aoqi@0 | 212 | |
aoqi@0 | 213 | if (((Element) currentAncestor).hasAttributeNS( |
aoqi@0 | 214 | XMLNS_URI, prefix)) { |
aoqi@0 | 215 | return ((Element) currentAncestor).getAttributeNS( |
aoqi@0 | 216 | XMLNS_URI, prefix); |
aoqi@0 | 217 | } |
aoqi@0 | 218 | |
aoqi@0 | 219 | currentAncestor = currentAncestor.getParentNode(); |
aoqi@0 | 220 | } |
aoqi@0 | 221 | } |
aoqi@0 | 222 | |
aoqi@0 | 223 | return null; |
aoqi@0 | 224 | } |
aoqi@0 | 225 | |
aoqi@0 | 226 | public SOAPElement setElementQName(QName newName) throws SOAPException { |
aoqi@0 | 227 | ElementImpl copy = |
aoqi@0 | 228 | new ElementImpl((SOAPDocumentImpl) getOwnerDocument(), newName); |
aoqi@0 | 229 | return replaceElementWithSOAPElement(this,copy); |
aoqi@0 | 230 | } |
aoqi@0 | 231 | |
aoqi@0 | 232 | public QName createQName(String localName, String prefix) |
aoqi@0 | 233 | throws SOAPException { |
aoqi@0 | 234 | String uri = getNamespaceURI(prefix); |
aoqi@0 | 235 | if (uri == null) { |
aoqi@0 | 236 | log.log(Level.SEVERE, "SAAJ0102.impl.cannot.locate.ns", |
aoqi@0 | 237 | new Object[] {prefix}); |
aoqi@0 | 238 | throw new SOAPException("Unable to locate namespace for prefix " |
aoqi@0 | 239 | + prefix); |
aoqi@0 | 240 | } |
aoqi@0 | 241 | return new QName(uri, localName, prefix); |
aoqi@0 | 242 | } |
aoqi@0 | 243 | |
aoqi@0 | 244 | public String getNamespacePrefix(String uri) { |
aoqi@0 | 245 | |
aoqi@0 | 246 | NamespaceContextIterator eachNamespace = getNamespaceContextNodes(); |
aoqi@0 | 247 | while (eachNamespace.hasNext()) { |
aoqi@0 | 248 | org.w3c.dom.Attr namespaceDecl = eachNamespace.nextNamespaceAttr(); |
aoqi@0 | 249 | if (namespaceDecl.getNodeValue().equals(uri)) { |
aoqi@0 | 250 | String candidatePrefix = namespaceDecl.getLocalName(); |
aoqi@0 | 251 | if ("xmlns".equals(candidatePrefix)) |
aoqi@0 | 252 | return ""; |
aoqi@0 | 253 | else |
aoqi@0 | 254 | return candidatePrefix; |
aoqi@0 | 255 | } |
aoqi@0 | 256 | } |
aoqi@0 | 257 | |
aoqi@0 | 258 | // Find if any of the ancestors' name has this uri |
aoqi@0 | 259 | org.w3c.dom.Node currentAncestor = this; |
aoqi@0 | 260 | while (currentAncestor != null && |
aoqi@0 | 261 | !(currentAncestor instanceof Document)) { |
aoqi@0 | 262 | |
aoqi@0 | 263 | if (uri.equals(currentAncestor.getNamespaceURI())) |
aoqi@0 | 264 | return currentAncestor.getPrefix(); |
aoqi@0 | 265 | currentAncestor = currentAncestor.getParentNode(); |
aoqi@0 | 266 | } |
aoqi@0 | 267 | |
aoqi@0 | 268 | return null; |
aoqi@0 | 269 | } |
aoqi@0 | 270 | |
aoqi@0 | 271 | protected org.w3c.dom.Attr getNamespaceAttr(String prefix) { |
aoqi@0 | 272 | NamespaceContextIterator eachNamespace = getNamespaceContextNodes(); |
aoqi@0 | 273 | if (!"".equals(prefix)) |
aoqi@0 | 274 | prefix = ":"+prefix; |
aoqi@0 | 275 | while (eachNamespace.hasNext()) { |
aoqi@0 | 276 | org.w3c.dom.Attr namespaceDecl = eachNamespace.nextNamespaceAttr(); |
aoqi@0 | 277 | if (!"".equals(prefix)) { |
aoqi@0 | 278 | if (namespaceDecl.getNodeName().endsWith(prefix)) |
aoqi@0 | 279 | return namespaceDecl; |
aoqi@0 | 280 | } else { |
aoqi@0 | 281 | if (namespaceDecl.getNodeName().equals("xmlns")) |
aoqi@0 | 282 | return namespaceDecl; |
aoqi@0 | 283 | } |
aoqi@0 | 284 | } |
aoqi@0 | 285 | return null; |
aoqi@0 | 286 | } |
aoqi@0 | 287 | |
aoqi@0 | 288 | public NamespaceContextIterator getNamespaceContextNodes() { |
aoqi@0 | 289 | return getNamespaceContextNodes(true); |
aoqi@0 | 290 | } |
aoqi@0 | 291 | |
aoqi@0 | 292 | public NamespaceContextIterator getNamespaceContextNodes(boolean traverseStack) { |
aoqi@0 | 293 | return new NamespaceContextIterator(this, traverseStack); |
aoqi@0 | 294 | } |
aoqi@0 | 295 | |
aoqi@0 | 296 | public SOAPElement addChildElement( |
aoqi@0 | 297 | String localName, |
aoqi@0 | 298 | String prefix, |
aoqi@0 | 299 | String uri) |
aoqi@0 | 300 | throws SOAPException { |
aoqi@0 | 301 | |
aoqi@0 | 302 | SOAPElement newElement = createElement(NameImpl.create(localName, prefix, uri)); |
aoqi@0 | 303 | addNode(newElement); |
aoqi@0 | 304 | return convertToSoapElement(newElement); |
aoqi@0 | 305 | } |
aoqi@0 | 306 | |
aoqi@0 | 307 | public SOAPElement addChildElement(SOAPElement element) |
aoqi@0 | 308 | throws SOAPException { |
aoqi@0 | 309 | |
aoqi@0 | 310 | // check if Element falls in SOAP 1.1 or 1.2 namespace. |
aoqi@0 | 311 | String elementURI = element.getElementName().getURI(); |
aoqi@0 | 312 | String localName = element.getLocalName(); |
aoqi@0 | 313 | |
aoqi@0 | 314 | if ((SOAPConstants.URI_NS_SOAP_ENVELOPE).equals(elementURI) |
aoqi@0 | 315 | || (SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE).equals(elementURI)) { |
aoqi@0 | 316 | |
aoqi@0 | 317 | |
aoqi@0 | 318 | if ("Envelope".equalsIgnoreCase(localName) || |
aoqi@0 | 319 | "Header".equalsIgnoreCase(localName) || "Body".equalsIgnoreCase(localName)) { |
aoqi@0 | 320 | log.severe("SAAJ0103.impl.cannot.add.fragements"); |
aoqi@0 | 321 | throw new SOAPExceptionImpl( |
aoqi@0 | 322 | "Cannot add fragments which contain elements " |
aoqi@0 | 323 | + "which are in the SOAP namespace"); |
aoqi@0 | 324 | } |
aoqi@0 | 325 | |
aoqi@0 | 326 | if ("Fault".equalsIgnoreCase(localName) && !"Body".equalsIgnoreCase(this.getLocalName())) { |
aoqi@0 | 327 | log.severe("SAAJ0154.impl.adding.fault.to.nonbody"); |
aoqi@0 | 328 | throw new SOAPExceptionImpl("Cannot add a SOAPFault as a child of " + this.getLocalName()); |
aoqi@0 | 329 | } |
aoqi@0 | 330 | |
aoqi@0 | 331 | if ("Detail".equalsIgnoreCase(localName) && !"Fault".equalsIgnoreCase(this.getLocalName())) { |
aoqi@0 | 332 | log.severe("SAAJ0155.impl.adding.detail.nonfault"); |
aoqi@0 | 333 | throw new SOAPExceptionImpl("Cannot add a Detail as a child of " + this.getLocalName()); |
aoqi@0 | 334 | } |
aoqi@0 | 335 | |
aoqi@0 | 336 | if ("Fault".equalsIgnoreCase(localName)) { |
aoqi@0 | 337 | // if body is not empty throw an exception |
aoqi@0 | 338 | if (!elementURI.equals(this.getElementName().getURI())) { |
aoqi@0 | 339 | log.severe("SAAJ0158.impl.version.mismatch.fault"); |
aoqi@0 | 340 | throw new SOAPExceptionImpl("SOAP Version mismatch encountered when trying to add SOAPFault to SOAPBody"); |
aoqi@0 | 341 | } |
aoqi@0 | 342 | Iterator it = this.getChildElements(); |
aoqi@0 | 343 | if (it.hasNext()) { |
aoqi@0 | 344 | log.severe("SAAJ0156.impl.adding.fault.error"); |
aoqi@0 | 345 | throw new SOAPExceptionImpl("Cannot add SOAPFault as a child of a non-Empty SOAPBody"); |
aoqi@0 | 346 | } |
aoqi@0 | 347 | } |
aoqi@0 | 348 | } |
aoqi@0 | 349 | |
aoqi@0 | 350 | // preserve the encodingStyle attr as it may get lost in the import |
aoqi@0 | 351 | String encodingStyle = element.getEncodingStyle(); |
aoqi@0 | 352 | |
aoqi@0 | 353 | ElementImpl importedElement = (ElementImpl) importElement(element); |
aoqi@0 | 354 | addNode(importedElement); |
aoqi@0 | 355 | |
aoqi@0 | 356 | if (encodingStyle != null) |
aoqi@0 | 357 | importedElement.setEncodingStyle(encodingStyle); |
aoqi@0 | 358 | |
aoqi@0 | 359 | return convertToSoapElement(importedElement); |
aoqi@0 | 360 | } |
aoqi@0 | 361 | |
aoqi@0 | 362 | protected Element importElement(Element element) { |
aoqi@0 | 363 | Document document = getOwnerDocument(); |
aoqi@0 | 364 | Document oldDocument = element.getOwnerDocument(); |
aoqi@0 | 365 | if (!oldDocument.equals(document)) { |
aoqi@0 | 366 | return (Element) document.importNode(element, true); |
aoqi@0 | 367 | } else { |
aoqi@0 | 368 | return element; |
aoqi@0 | 369 | } |
aoqi@0 | 370 | } |
aoqi@0 | 371 | |
aoqi@0 | 372 | protected SOAPElement addElement(Name name) throws SOAPException { |
aoqi@0 | 373 | SOAPElement newElement = createElement(name); |
aoqi@0 | 374 | addNode(newElement); |
aoqi@0 | 375 | return circumventBug5034339(newElement); |
aoqi@0 | 376 | } |
aoqi@0 | 377 | |
aoqi@0 | 378 | protected SOAPElement addElement(QName name) throws SOAPException { |
aoqi@0 | 379 | SOAPElement newElement = createElement(name); |
aoqi@0 | 380 | addNode(newElement); |
aoqi@0 | 381 | return circumventBug5034339(newElement); |
aoqi@0 | 382 | } |
aoqi@0 | 383 | |
aoqi@0 | 384 | protected SOAPElement createElement(Name name) { |
aoqi@0 | 385 | |
aoqi@0 | 386 | if (isNamespaceQualified(name)) { |
aoqi@0 | 387 | return (SOAPElement) |
aoqi@0 | 388 | getOwnerDocument().createElementNS( |
aoqi@0 | 389 | name.getURI(), |
aoqi@0 | 390 | name.getQualifiedName()); |
aoqi@0 | 391 | } else { |
aoqi@0 | 392 | return (SOAPElement) |
aoqi@0 | 393 | getOwnerDocument().createElement(name.getQualifiedName()); |
aoqi@0 | 394 | } |
aoqi@0 | 395 | } |
aoqi@0 | 396 | |
aoqi@0 | 397 | protected SOAPElement createElement(QName name) { |
aoqi@0 | 398 | |
aoqi@0 | 399 | if (isNamespaceQualified(name)) { |
aoqi@0 | 400 | return (SOAPElement) |
aoqi@0 | 401 | getOwnerDocument().createElementNS( |
aoqi@0 | 402 | name.getNamespaceURI(), |
aoqi@0 | 403 | getQualifiedName(name)); |
aoqi@0 | 404 | } else { |
aoqi@0 | 405 | return (SOAPElement) |
aoqi@0 | 406 | getOwnerDocument().createElement(getQualifiedName(name)); |
aoqi@0 | 407 | } |
aoqi@0 | 408 | } |
aoqi@0 | 409 | |
aoqi@0 | 410 | protected void addNode(org.w3c.dom.Node newElement) throws SOAPException { |
aoqi@0 | 411 | insertBefore(newElement, null); |
aoqi@0 | 412 | |
aoqi@0 | 413 | if (getOwnerDocument() instanceof DocumentFragment) |
aoqi@0 | 414 | return; |
aoqi@0 | 415 | |
aoqi@0 | 416 | if (newElement instanceof ElementImpl) { |
aoqi@0 | 417 | ElementImpl element = (ElementImpl) newElement; |
aoqi@0 | 418 | QName elementName = element.getElementQName(); |
aoqi@0 | 419 | if (!"".equals(elementName.getNamespaceURI())) { |
aoqi@0 | 420 | element.ensureNamespaceIsDeclared( |
aoqi@0 | 421 | elementName.getPrefix(), elementName.getNamespaceURI()); |
aoqi@0 | 422 | } |
aoqi@0 | 423 | } |
aoqi@0 | 424 | |
aoqi@0 | 425 | } |
aoqi@0 | 426 | |
aoqi@0 | 427 | protected SOAPElement findChild(NameImpl name) { |
aoqi@0 | 428 | Iterator eachChild = getChildElementNodes(); |
aoqi@0 | 429 | while (eachChild.hasNext()) { |
aoqi@0 | 430 | SOAPElement child = (SOAPElement) eachChild.next(); |
aoqi@0 | 431 | if (child.getElementName().equals(name)) { |
aoqi@0 | 432 | return child; |
aoqi@0 | 433 | } |
aoqi@0 | 434 | } |
aoqi@0 | 435 | |
aoqi@0 | 436 | return null; |
aoqi@0 | 437 | } |
aoqi@0 | 438 | |
aoqi@0 | 439 | public SOAPElement addTextNode(String text) throws SOAPException { |
aoqi@0 | 440 | if (text.startsWith(CDATAImpl.cdataUC) |
aoqi@0 | 441 | || text.startsWith(CDATAImpl.cdataLC)) |
aoqi@0 | 442 | return addCDATA( |
aoqi@0 | 443 | text.substring(CDATAImpl.cdataUC.length(), text.length() - 3)); |
aoqi@0 | 444 | return addText(text); |
aoqi@0 | 445 | } |
aoqi@0 | 446 | |
aoqi@0 | 447 | protected SOAPElement addCDATA(String text) throws SOAPException { |
aoqi@0 | 448 | org.w3c.dom.Text cdata = |
aoqi@0 | 449 | (org.w3c.dom.Text) getOwnerDocument().createCDATASection(text); |
aoqi@0 | 450 | addNode(cdata); |
aoqi@0 | 451 | return this; |
aoqi@0 | 452 | } |
aoqi@0 | 453 | |
aoqi@0 | 454 | protected SOAPElement addText(String text) throws SOAPException { |
aoqi@0 | 455 | org.w3c.dom.Text textNode = |
aoqi@0 | 456 | (org.w3c.dom.Text) getOwnerDocument().createTextNode(text); |
aoqi@0 | 457 | addNode(textNode); |
aoqi@0 | 458 | return this; |
aoqi@0 | 459 | } |
aoqi@0 | 460 | |
aoqi@0 | 461 | public SOAPElement addAttribute(Name name, String value) |
aoqi@0 | 462 | throws SOAPException { |
aoqi@0 | 463 | addAttributeBare(name, value); |
aoqi@0 | 464 | if (!"".equals(name.getURI())) { |
aoqi@0 | 465 | ensureNamespaceIsDeclared(name.getPrefix(), name.getURI()); |
aoqi@0 | 466 | } |
aoqi@0 | 467 | return this; |
aoqi@0 | 468 | } |
aoqi@0 | 469 | |
aoqi@0 | 470 | public SOAPElement addAttribute(QName qname, String value) |
aoqi@0 | 471 | throws SOAPException { |
aoqi@0 | 472 | addAttributeBare(qname, value); |
aoqi@0 | 473 | if (!"".equals(qname.getNamespaceURI())) { |
aoqi@0 | 474 | ensureNamespaceIsDeclared(qname.getPrefix(), qname.getNamespaceURI()); |
aoqi@0 | 475 | } |
aoqi@0 | 476 | return this; |
aoqi@0 | 477 | } |
aoqi@0 | 478 | |
aoqi@0 | 479 | private void addAttributeBare(Name name, String value) { |
aoqi@0 | 480 | addAttributeBare( |
aoqi@0 | 481 | name.getURI(), |
aoqi@0 | 482 | name.getPrefix(), |
aoqi@0 | 483 | name.getQualifiedName(), |
aoqi@0 | 484 | value); |
aoqi@0 | 485 | } |
aoqi@0 | 486 | private void addAttributeBare(QName name, String value) { |
aoqi@0 | 487 | addAttributeBare( |
aoqi@0 | 488 | name.getNamespaceURI(), |
aoqi@0 | 489 | name.getPrefix(), |
aoqi@0 | 490 | getQualifiedName(name), |
aoqi@0 | 491 | value); |
aoqi@0 | 492 | } |
aoqi@0 | 493 | |
aoqi@0 | 494 | private void addAttributeBare( |
aoqi@0 | 495 | String uri, |
aoqi@0 | 496 | String prefix, |
aoqi@0 | 497 | String qualifiedName, |
aoqi@0 | 498 | String value) { |
aoqi@0 | 499 | |
aoqi@0 | 500 | uri = uri.length() == 0 ? null : uri; |
aoqi@0 | 501 | if (qualifiedName.equals("xmlns")) { |
aoqi@0 | 502 | uri = XMLNS_URI; |
aoqi@0 | 503 | } |
aoqi@0 | 504 | |
aoqi@0 | 505 | if (uri == null) { |
aoqi@0 | 506 | setAttribute(qualifiedName, value); |
aoqi@0 | 507 | } else { |
aoqi@0 | 508 | setAttributeNS(uri, qualifiedName, value); |
aoqi@0 | 509 | } |
aoqi@0 | 510 | } |
aoqi@0 | 511 | |
aoqi@0 | 512 | public SOAPElement addNamespaceDeclaration(String prefix, String uri) |
aoqi@0 | 513 | throws SOAPException { |
aoqi@0 | 514 | if (prefix.length() > 0) { |
aoqi@0 | 515 | setAttributeNS(XMLNS_URI, "xmlns:" + prefix, uri); |
aoqi@0 | 516 | } else { |
aoqi@0 | 517 | setAttributeNS(XMLNS_URI, "xmlns", uri); |
aoqi@0 | 518 | } |
aoqi@0 | 519 | //Fix for CR:6474641 |
aoqi@0 | 520 | //tryToFindEncodingStyleAttributeName(); |
aoqi@0 | 521 | return this; |
aoqi@0 | 522 | } |
aoqi@0 | 523 | |
aoqi@0 | 524 | public String getAttributeValue(Name name) { |
aoqi@0 | 525 | return getAttributeValueFrom(this, name); |
aoqi@0 | 526 | } |
aoqi@0 | 527 | |
aoqi@0 | 528 | public String getAttributeValue(QName qname) { |
aoqi@0 | 529 | return getAttributeValueFrom( |
aoqi@0 | 530 | this, |
aoqi@0 | 531 | qname.getNamespaceURI(), |
aoqi@0 | 532 | qname.getLocalPart(), |
aoqi@0 | 533 | qname.getPrefix(), |
aoqi@0 | 534 | getQualifiedName(qname)); |
aoqi@0 | 535 | } |
aoqi@0 | 536 | |
aoqi@0 | 537 | public Iterator getAllAttributes() { |
aoqi@0 | 538 | Iterator i = getAllAttributesFrom(this); |
aoqi@0 | 539 | ArrayList list = new ArrayList(); |
aoqi@0 | 540 | while (i.hasNext()) { |
aoqi@0 | 541 | Name name = (Name) i.next(); |
aoqi@0 | 542 | if (!"xmlns".equalsIgnoreCase(name.getPrefix())) |
aoqi@0 | 543 | list.add(name); |
aoqi@0 | 544 | } |
aoqi@0 | 545 | return list.iterator(); |
aoqi@0 | 546 | } |
aoqi@0 | 547 | |
aoqi@0 | 548 | public Iterator getAllAttributesAsQNames() { |
aoqi@0 | 549 | Iterator i = getAllAttributesFrom(this); |
aoqi@0 | 550 | ArrayList list = new ArrayList(); |
aoqi@0 | 551 | while (i.hasNext()) { |
aoqi@0 | 552 | Name name = (Name) i.next(); |
aoqi@0 | 553 | if (!"xmlns".equalsIgnoreCase(name.getPrefix())) { |
aoqi@0 | 554 | list.add(NameImpl.convertToQName(name)); |
aoqi@0 | 555 | } |
aoqi@0 | 556 | } |
aoqi@0 | 557 | return list.iterator(); |
aoqi@0 | 558 | } |
aoqi@0 | 559 | |
aoqi@0 | 560 | |
aoqi@0 | 561 | public Iterator getNamespacePrefixes() { |
aoqi@0 | 562 | return doGetNamespacePrefixes(false); |
aoqi@0 | 563 | } |
aoqi@0 | 564 | |
aoqi@0 | 565 | public Iterator getVisibleNamespacePrefixes() { |
aoqi@0 | 566 | return doGetNamespacePrefixes(true); |
aoqi@0 | 567 | } |
aoqi@0 | 568 | |
aoqi@0 | 569 | protected Iterator doGetNamespacePrefixes(final boolean deep) { |
aoqi@0 | 570 | return new Iterator() { |
aoqi@0 | 571 | String next = null; |
aoqi@0 | 572 | String last = null; |
aoqi@0 | 573 | NamespaceContextIterator eachNamespace = |
aoqi@0 | 574 | getNamespaceContextNodes(deep); |
aoqi@0 | 575 | |
aoqi@0 | 576 | void findNext() { |
aoqi@0 | 577 | while (next == null && eachNamespace.hasNext()) { |
aoqi@0 | 578 | String attributeKey = |
aoqi@0 | 579 | eachNamespace.nextNamespaceAttr().getNodeName(); |
aoqi@0 | 580 | if (attributeKey.startsWith("xmlns:")) { |
aoqi@0 | 581 | next = attributeKey.substring("xmlns:".length()); |
aoqi@0 | 582 | } |
aoqi@0 | 583 | } |
aoqi@0 | 584 | } |
aoqi@0 | 585 | |
aoqi@0 | 586 | public boolean hasNext() { |
aoqi@0 | 587 | findNext(); |
aoqi@0 | 588 | return next != null; |
aoqi@0 | 589 | } |
aoqi@0 | 590 | |
aoqi@0 | 591 | public Object next() { |
aoqi@0 | 592 | findNext(); |
aoqi@0 | 593 | if (next == null) { |
aoqi@0 | 594 | throw new NoSuchElementException(); |
aoqi@0 | 595 | } |
aoqi@0 | 596 | |
aoqi@0 | 597 | last = next; |
aoqi@0 | 598 | next = null; |
aoqi@0 | 599 | return last; |
aoqi@0 | 600 | } |
aoqi@0 | 601 | |
aoqi@0 | 602 | public void remove() { |
aoqi@0 | 603 | if (last == null) { |
aoqi@0 | 604 | throw new IllegalStateException(); |
aoqi@0 | 605 | } |
aoqi@0 | 606 | eachNamespace.remove(); |
aoqi@0 | 607 | next = null; |
aoqi@0 | 608 | last = null; |
aoqi@0 | 609 | } |
aoqi@0 | 610 | }; |
aoqi@0 | 611 | } |
aoqi@0 | 612 | |
aoqi@0 | 613 | public Name getElementName() { |
aoqi@0 | 614 | return NameImpl.convertToName(elementQName); |
aoqi@0 | 615 | } |
aoqi@0 | 616 | |
aoqi@0 | 617 | public QName getElementQName() { |
aoqi@0 | 618 | return elementQName; |
aoqi@0 | 619 | } |
aoqi@0 | 620 | |
aoqi@0 | 621 | public boolean removeAttribute(Name name) { |
aoqi@0 | 622 | return removeAttribute(name.getURI(), name.getLocalName()); |
aoqi@0 | 623 | } |
aoqi@0 | 624 | |
aoqi@0 | 625 | public boolean removeAttribute(QName name) { |
aoqi@0 | 626 | return removeAttribute(name.getNamespaceURI(), name.getLocalPart()); |
aoqi@0 | 627 | } |
aoqi@0 | 628 | |
aoqi@0 | 629 | private boolean removeAttribute(String uri, String localName) { |
aoqi@0 | 630 | String nonzeroLengthUri = |
aoqi@0 | 631 | (uri == null || uri.length() == 0) ? null : uri; |
aoqi@0 | 632 | org.w3c.dom.Attr attribute = |
aoqi@0 | 633 | getAttributeNodeNS(nonzeroLengthUri, localName); |
aoqi@0 | 634 | if (attribute == null) { |
aoqi@0 | 635 | return false; |
aoqi@0 | 636 | } |
aoqi@0 | 637 | removeAttributeNode(attribute); |
aoqi@0 | 638 | return true; |
aoqi@0 | 639 | } |
aoqi@0 | 640 | |
aoqi@0 | 641 | public boolean removeNamespaceDeclaration(String prefix) { |
aoqi@0 | 642 | org.w3c.dom.Attr declaration = getNamespaceAttr(prefix); |
aoqi@0 | 643 | if (declaration == null) { |
aoqi@0 | 644 | return false; |
aoqi@0 | 645 | } |
aoqi@0 | 646 | try { |
aoqi@0 | 647 | removeAttributeNode(declaration); |
aoqi@0 | 648 | } catch (DOMException de) { |
aoqi@0 | 649 | // ignore |
aoqi@0 | 650 | } |
aoqi@0 | 651 | return true; |
aoqi@0 | 652 | } |
aoqi@0 | 653 | |
aoqi@0 | 654 | public Iterator getChildElements() { |
aoqi@0 | 655 | return getChildElementsFrom(this); |
aoqi@0 | 656 | } |
aoqi@0 | 657 | |
aoqi@0 | 658 | protected SOAPElement convertToSoapElement(Element element) { |
aoqi@0 | 659 | if (element instanceof SOAPElement) { |
aoqi@0 | 660 | return (SOAPElement) element; |
aoqi@0 | 661 | } else { |
aoqi@0 | 662 | return replaceElementWithSOAPElement( |
aoqi@0 | 663 | element, |
aoqi@0 | 664 | (ElementImpl) createElement(NameImpl.copyElementName(element))); |
aoqi@0 | 665 | } |
aoqi@0 | 666 | } |
aoqi@0 | 667 | |
aoqi@0 | 668 | protected static SOAPElement replaceElementWithSOAPElement( |
aoqi@0 | 669 | Element element, |
aoqi@0 | 670 | ElementImpl copy) { |
aoqi@0 | 671 | |
aoqi@0 | 672 | Iterator eachAttribute = getAllAttributesFrom(element); |
aoqi@0 | 673 | while (eachAttribute.hasNext()) { |
aoqi@0 | 674 | Name name = (Name) eachAttribute.next(); |
aoqi@0 | 675 | copy.addAttributeBare(name, getAttributeValueFrom(element, name)); |
aoqi@0 | 676 | } |
aoqi@0 | 677 | |
aoqi@0 | 678 | Iterator eachChild = getChildElementsFrom(element); |
aoqi@0 | 679 | while (eachChild.hasNext()) { |
aoqi@0 | 680 | Node nextChild = (Node) eachChild.next(); |
aoqi@0 | 681 | copy.insertBefore(nextChild, null); |
aoqi@0 | 682 | } |
aoqi@0 | 683 | |
aoqi@0 | 684 | Node parent = element.getParentNode(); |
aoqi@0 | 685 | if (parent != null) { |
aoqi@0 | 686 | parent.replaceChild(copy, element); |
aoqi@0 | 687 | } // XXX else throw an exception? |
aoqi@0 | 688 | |
aoqi@0 | 689 | return copy; |
aoqi@0 | 690 | } |
aoqi@0 | 691 | |
aoqi@0 | 692 | protected Iterator getChildElementNodes() { |
aoqi@0 | 693 | return new Iterator() { |
aoqi@0 | 694 | Iterator eachNode = getChildElements(); |
aoqi@0 | 695 | Node next = null; |
aoqi@0 | 696 | Node last = null; |
aoqi@0 | 697 | |
aoqi@0 | 698 | public boolean hasNext() { |
aoqi@0 | 699 | if (next == null) { |
aoqi@0 | 700 | while (eachNode.hasNext()) { |
aoqi@0 | 701 | Node node = (Node) eachNode.next(); |
aoqi@0 | 702 | if (node instanceof SOAPElement) { |
aoqi@0 | 703 | next = node; |
aoqi@0 | 704 | break; |
aoqi@0 | 705 | } |
aoqi@0 | 706 | } |
aoqi@0 | 707 | } |
aoqi@0 | 708 | return next != null; |
aoqi@0 | 709 | } |
aoqi@0 | 710 | |
aoqi@0 | 711 | public Object next() { |
aoqi@0 | 712 | if (hasNext()) { |
aoqi@0 | 713 | last = next; |
aoqi@0 | 714 | next = null; |
aoqi@0 | 715 | return last; |
aoqi@0 | 716 | } |
aoqi@0 | 717 | throw new NoSuchElementException(); |
aoqi@0 | 718 | } |
aoqi@0 | 719 | |
aoqi@0 | 720 | public void remove() { |
aoqi@0 | 721 | if (last == null) { |
aoqi@0 | 722 | throw new IllegalStateException(); |
aoqi@0 | 723 | } |
aoqi@0 | 724 | Node target = last; |
aoqi@0 | 725 | last = null; |
aoqi@0 | 726 | removeChild(target); |
aoqi@0 | 727 | } |
aoqi@0 | 728 | }; |
aoqi@0 | 729 | } |
aoqi@0 | 730 | |
aoqi@0 | 731 | public Iterator getChildElements(final Name name) { |
aoqi@0 | 732 | return getChildElements(name.getURI(), name.getLocalName()); |
aoqi@0 | 733 | } |
aoqi@0 | 734 | |
aoqi@0 | 735 | public Iterator getChildElements(final QName qname) { |
aoqi@0 | 736 | return getChildElements(qname.getNamespaceURI(), qname.getLocalPart()); |
aoqi@0 | 737 | } |
aoqi@0 | 738 | |
aoqi@0 | 739 | private Iterator getChildElements(final String nameUri, final String nameLocal) { |
aoqi@0 | 740 | return new Iterator() { |
aoqi@0 | 741 | Iterator eachElement = getChildElementNodes(); |
aoqi@0 | 742 | Node next = null; |
aoqi@0 | 743 | Node last = null; |
aoqi@0 | 744 | |
aoqi@0 | 745 | public boolean hasNext() { |
aoqi@0 | 746 | if (next == null) { |
aoqi@0 | 747 | while (eachElement.hasNext()) { |
aoqi@0 | 748 | Node element = (Node) eachElement.next(); |
aoqi@0 | 749 | String elementUri = element.getNamespaceURI(); |
aoqi@0 | 750 | elementUri = elementUri == null ? "" : elementUri; |
aoqi@0 | 751 | String elementName = element.getLocalName(); |
aoqi@0 | 752 | if (elementUri.equals(nameUri) |
aoqi@0 | 753 | && elementName.equals(nameLocal)) { |
aoqi@0 | 754 | next = element; |
aoqi@0 | 755 | break; |
aoqi@0 | 756 | } |
aoqi@0 | 757 | } |
aoqi@0 | 758 | } |
aoqi@0 | 759 | return next != null; |
aoqi@0 | 760 | } |
aoqi@0 | 761 | |
aoqi@0 | 762 | public Object next() { |
aoqi@0 | 763 | if (!hasNext()) { |
aoqi@0 | 764 | throw new NoSuchElementException(); |
aoqi@0 | 765 | } |
aoqi@0 | 766 | last = next; |
aoqi@0 | 767 | next = null; |
aoqi@0 | 768 | return last; |
aoqi@0 | 769 | } |
aoqi@0 | 770 | |
aoqi@0 | 771 | public void remove() { |
aoqi@0 | 772 | if (last == null) { |
aoqi@0 | 773 | throw new IllegalStateException(); |
aoqi@0 | 774 | } |
aoqi@0 | 775 | Node target = last; |
aoqi@0 | 776 | last = null; |
aoqi@0 | 777 | removeChild(target); |
aoqi@0 | 778 | } |
aoqi@0 | 779 | }; |
aoqi@0 | 780 | } |
aoqi@0 | 781 | |
aoqi@0 | 782 | public void removeContents() { |
aoqi@0 | 783 | Node currentChild = getFirstChild(); |
aoqi@0 | 784 | |
aoqi@0 | 785 | while (currentChild != null) { |
aoqi@0 | 786 | Node temp = currentChild.getNextSibling(); |
aoqi@0 | 787 | if (currentChild instanceof javax.xml.soap.Node) { |
aoqi@0 | 788 | ((javax.xml.soap.Node) currentChild).detachNode(); |
aoqi@0 | 789 | } else { |
aoqi@0 | 790 | Node parent = currentChild.getParentNode(); |
aoqi@0 | 791 | if (parent != null) { |
aoqi@0 | 792 | parent.removeChild(currentChild); |
aoqi@0 | 793 | } |
aoqi@0 | 794 | |
aoqi@0 | 795 | } |
aoqi@0 | 796 | currentChild = temp; |
aoqi@0 | 797 | } |
aoqi@0 | 798 | } |
aoqi@0 | 799 | |
aoqi@0 | 800 | public void setEncodingStyle(String encodingStyle) throws SOAPException { |
aoqi@0 | 801 | if (!"".equals(encodingStyle)) { |
aoqi@0 | 802 | try { |
aoqi@0 | 803 | new URI(encodingStyle); |
aoqi@0 | 804 | } catch (URISyntaxException m) { |
aoqi@0 | 805 | log.log( |
aoqi@0 | 806 | Level.SEVERE, |
aoqi@0 | 807 | "SAAJ0105.impl.encoding.style.mustbe.valid.URI", |
aoqi@0 | 808 | new String[] { encodingStyle }); |
aoqi@0 | 809 | throw new IllegalArgumentException( |
aoqi@0 | 810 | "Encoding style (" + encodingStyle + ") should be a valid URI"); |
aoqi@0 | 811 | } |
aoqi@0 | 812 | } |
aoqi@0 | 813 | encodingStyleAttribute.setValue(encodingStyle); |
aoqi@0 | 814 | tryToFindEncodingStyleAttributeName(); |
aoqi@0 | 815 | } |
aoqi@0 | 816 | |
aoqi@0 | 817 | public String getEncodingStyle() { |
aoqi@0 | 818 | String encodingStyle = encodingStyleAttribute.getValue(); |
aoqi@0 | 819 | if (encodingStyle != null) |
aoqi@0 | 820 | return encodingStyle; |
aoqi@0 | 821 | String soapNamespace = getSOAPNamespace(); |
aoqi@0 | 822 | if (soapNamespace != null) { |
aoqi@0 | 823 | Attr attr = getAttributeNodeNS(soapNamespace, "encodingStyle"); |
aoqi@0 | 824 | if (attr != null) { |
aoqi@0 | 825 | encodingStyle = attr.getValue(); |
aoqi@0 | 826 | try { |
aoqi@0 | 827 | setEncodingStyle(encodingStyle); |
aoqi@0 | 828 | } catch (SOAPException se) { |
aoqi@0 | 829 | // has to be ignored |
aoqi@0 | 830 | } |
aoqi@0 | 831 | return encodingStyle; |
aoqi@0 | 832 | } |
aoqi@0 | 833 | } |
aoqi@0 | 834 | return null; |
aoqi@0 | 835 | } |
aoqi@0 | 836 | |
aoqi@0 | 837 | // Node methods |
aoqi@0 | 838 | public String getValue() { |
aoqi@0 | 839 | javax.xml.soap.Node valueNode = getValueNode(); |
aoqi@0 | 840 | return valueNode == null ? null : valueNode.getValue(); |
aoqi@0 | 841 | } |
aoqi@0 | 842 | |
aoqi@0 | 843 | public void setValue(String value) { |
aoqi@0 | 844 | Node valueNode = getValueNodeStrict(); |
aoqi@0 | 845 | if (valueNode != null) { |
aoqi@0 | 846 | valueNode.setNodeValue(value); |
aoqi@0 | 847 | } else { |
aoqi@0 | 848 | try { |
aoqi@0 | 849 | addTextNode(value); |
aoqi@0 | 850 | } catch (SOAPException e) { |
aoqi@0 | 851 | throw new RuntimeException(e.getMessage()); |
aoqi@0 | 852 | } |
aoqi@0 | 853 | } |
aoqi@0 | 854 | } |
aoqi@0 | 855 | |
aoqi@0 | 856 | protected Node getValueNodeStrict() { |
aoqi@0 | 857 | Node node = getFirstChild(); |
aoqi@0 | 858 | if (node != null) { |
aoqi@0 | 859 | if (node.getNextSibling() == null |
aoqi@0 | 860 | && node.getNodeType() == org.w3c.dom.Node.TEXT_NODE) { |
aoqi@0 | 861 | return node; |
aoqi@0 | 862 | } else { |
aoqi@0 | 863 | log.severe("SAAJ0107.impl.elem.child.not.single.text"); |
aoqi@0 | 864 | throw new IllegalStateException(); |
aoqi@0 | 865 | } |
aoqi@0 | 866 | } |
aoqi@0 | 867 | |
aoqi@0 | 868 | return null; |
aoqi@0 | 869 | } |
aoqi@0 | 870 | |
aoqi@0 | 871 | protected javax.xml.soap.Node getValueNode() { |
aoqi@0 | 872 | Iterator i = getChildElements(); |
aoqi@0 | 873 | while (i.hasNext()) { |
aoqi@0 | 874 | javax.xml.soap.Node n = (javax.xml.soap.Node) i.next(); |
aoqi@0 | 875 | if (n.getNodeType() == org.w3c.dom.Node.TEXT_NODE || |
aoqi@0 | 876 | n.getNodeType() == org.w3c.dom.Node.CDATA_SECTION_NODE) { |
aoqi@0 | 877 | // TODO: Hack to fix text node split into multiple lines. |
aoqi@0 | 878 | normalize(); |
aoqi@0 | 879 | // Should remove the normalization step when this gets fixed in |
aoqi@0 | 880 | // DOM/Xerces. |
aoqi@0 | 881 | return (javax.xml.soap.Node) n; |
aoqi@0 | 882 | } |
aoqi@0 | 883 | } |
aoqi@0 | 884 | return null; |
aoqi@0 | 885 | } |
aoqi@0 | 886 | |
aoqi@0 | 887 | public void setParentElement(SOAPElement element) throws SOAPException { |
aoqi@0 | 888 | if (element == null) { |
aoqi@0 | 889 | log.severe("SAAJ0106.impl.no.null.to.parent.elem"); |
aoqi@0 | 890 | throw new SOAPException("Cannot pass NULL to setParentElement"); |
aoqi@0 | 891 | } |
aoqi@0 | 892 | element.addChildElement(this); |
aoqi@0 | 893 | findEncodingStyleAttributeName(); |
aoqi@0 | 894 | } |
aoqi@0 | 895 | |
aoqi@0 | 896 | protected void findEncodingStyleAttributeName() throws SOAPException { |
aoqi@0 | 897 | String soapNamespace = getSOAPNamespace(); |
aoqi@0 | 898 | if (soapNamespace != null) { |
aoqi@0 | 899 | String soapNamespacePrefix = getNamespacePrefix(soapNamespace); |
aoqi@0 | 900 | if (soapNamespacePrefix != null) { |
aoqi@0 | 901 | setEncodingStyleNamespace(soapNamespace, soapNamespacePrefix); |
aoqi@0 | 902 | } |
aoqi@0 | 903 | } |
aoqi@0 | 904 | } |
aoqi@0 | 905 | |
aoqi@0 | 906 | protected void setEncodingStyleNamespace( |
aoqi@0 | 907 | String soapNamespace, |
aoqi@0 | 908 | String soapNamespacePrefix) |
aoqi@0 | 909 | throws SOAPException { |
aoqi@0 | 910 | Name encodingStyleAttributeName = |
aoqi@0 | 911 | NameImpl.create( |
aoqi@0 | 912 | "encodingStyle", |
aoqi@0 | 913 | soapNamespacePrefix, |
aoqi@0 | 914 | soapNamespace); |
aoqi@0 | 915 | encodingStyleAttribute.setName(encodingStyleAttributeName); |
aoqi@0 | 916 | } |
aoqi@0 | 917 | |
aoqi@0 | 918 | public SOAPElement getParentElement() { |
aoqi@0 | 919 | Node parentNode = getParentNode(); |
aoqi@0 | 920 | if (parentNode instanceof SOAPDocument) { |
aoqi@0 | 921 | return null; |
aoqi@0 | 922 | } |
aoqi@0 | 923 | return (SOAPElement) parentNode; |
aoqi@0 | 924 | } |
aoqi@0 | 925 | |
aoqi@0 | 926 | protected String getSOAPNamespace() { |
aoqi@0 | 927 | String soapNamespace = null; |
aoqi@0 | 928 | |
aoqi@0 | 929 | SOAPElement antecedent = this; |
aoqi@0 | 930 | while (antecedent != null) { |
aoqi@0 | 931 | Name antecedentName = antecedent.getElementName(); |
aoqi@0 | 932 | String antecedentNamespace = antecedentName.getURI(); |
aoqi@0 | 933 | |
aoqi@0 | 934 | if (NameImpl.SOAP11_NAMESPACE.equals(antecedentNamespace) |
aoqi@0 | 935 | || NameImpl.SOAP12_NAMESPACE.equals(antecedentNamespace)) { |
aoqi@0 | 936 | |
aoqi@0 | 937 | soapNamespace = antecedentNamespace; |
aoqi@0 | 938 | break; |
aoqi@0 | 939 | } |
aoqi@0 | 940 | |
aoqi@0 | 941 | antecedent = antecedent.getParentElement(); |
aoqi@0 | 942 | } |
aoqi@0 | 943 | |
aoqi@0 | 944 | return soapNamespace; |
aoqi@0 | 945 | } |
aoqi@0 | 946 | |
aoqi@0 | 947 | public void detachNode() { |
aoqi@0 | 948 | Node parent = getParentNode(); |
aoqi@0 | 949 | if (parent != null) { |
aoqi@0 | 950 | parent.removeChild(this); |
aoqi@0 | 951 | } |
aoqi@0 | 952 | encodingStyleAttribute.clearNameAndValue(); |
aoqi@0 | 953 | // Fix for CR: 6474641 |
aoqi@0 | 954 | //tryToFindEncodingStyleAttributeName(); |
aoqi@0 | 955 | } |
aoqi@0 | 956 | |
aoqi@0 | 957 | public void tryToFindEncodingStyleAttributeName() { |
aoqi@0 | 958 | try { |
aoqi@0 | 959 | findEncodingStyleAttributeName(); |
aoqi@0 | 960 | } catch (SOAPException e) { /*okay to fail*/ |
aoqi@0 | 961 | } |
aoqi@0 | 962 | } |
aoqi@0 | 963 | |
aoqi@0 | 964 | public void recycleNode() { |
aoqi@0 | 965 | detachNode(); |
aoqi@0 | 966 | // TBD |
aoqi@0 | 967 | // - add this to the factory so subsequent |
aoqi@0 | 968 | // creations can reuse this object. |
aoqi@0 | 969 | } |
aoqi@0 | 970 | |
aoqi@0 | 971 | class AttributeManager { |
aoqi@0 | 972 | Name attributeName = null; |
aoqi@0 | 973 | String attributeValue = null; |
aoqi@0 | 974 | |
aoqi@0 | 975 | public void setName(Name newName) throws SOAPException { |
aoqi@0 | 976 | clearAttribute(); |
aoqi@0 | 977 | attributeName = newName; |
aoqi@0 | 978 | reconcileAttribute(); |
aoqi@0 | 979 | } |
aoqi@0 | 980 | public void clearName() { |
aoqi@0 | 981 | clearAttribute(); |
aoqi@0 | 982 | attributeName = null; |
aoqi@0 | 983 | } |
aoqi@0 | 984 | public void setValue(String value) throws SOAPException { |
aoqi@0 | 985 | attributeValue = value; |
aoqi@0 | 986 | reconcileAttribute(); |
aoqi@0 | 987 | } |
aoqi@0 | 988 | public Name getName() { |
aoqi@0 | 989 | return attributeName; |
aoqi@0 | 990 | } |
aoqi@0 | 991 | public String getValue() { |
aoqi@0 | 992 | return attributeValue; |
aoqi@0 | 993 | } |
aoqi@0 | 994 | |
aoqi@0 | 995 | /** Note: to be used only in detachNode method */ |
aoqi@0 | 996 | public void clearNameAndValue() { |
aoqi@0 | 997 | attributeName = null; |
aoqi@0 | 998 | attributeValue = null; |
aoqi@0 | 999 | } |
aoqi@0 | 1000 | |
aoqi@0 | 1001 | private void reconcileAttribute() throws SOAPException { |
aoqi@0 | 1002 | if (attributeName != null) { |
aoqi@0 | 1003 | removeAttribute(attributeName); |
aoqi@0 | 1004 | if (attributeValue != null) { |
aoqi@0 | 1005 | addAttribute(attributeName, attributeValue); |
aoqi@0 | 1006 | } |
aoqi@0 | 1007 | } |
aoqi@0 | 1008 | } |
aoqi@0 | 1009 | private void clearAttribute() { |
aoqi@0 | 1010 | if (attributeName != null) { |
aoqi@0 | 1011 | removeAttribute(attributeName); |
aoqi@0 | 1012 | } |
aoqi@0 | 1013 | } |
aoqi@0 | 1014 | } |
aoqi@0 | 1015 | |
aoqi@0 | 1016 | protected static org.w3c.dom.Attr getNamespaceAttrFrom( |
aoqi@0 | 1017 | Element element, |
aoqi@0 | 1018 | String prefix) { |
aoqi@0 | 1019 | NamespaceContextIterator eachNamespace = |
aoqi@0 | 1020 | new NamespaceContextIterator(element); |
aoqi@0 | 1021 | while (eachNamespace.hasNext()) { |
aoqi@0 | 1022 | org.w3c.dom.Attr namespaceDecl = eachNamespace.nextNamespaceAttr(); |
aoqi@0 | 1023 | String declaredPrefix = |
aoqi@0 | 1024 | NameImpl.getLocalNameFromTagName(namespaceDecl.getNodeName()); |
aoqi@0 | 1025 | if (declaredPrefix.equals(prefix)) { |
aoqi@0 | 1026 | return namespaceDecl; |
aoqi@0 | 1027 | } |
aoqi@0 | 1028 | } |
aoqi@0 | 1029 | return null; |
aoqi@0 | 1030 | } |
aoqi@0 | 1031 | |
aoqi@0 | 1032 | protected static Iterator getAllAttributesFrom(final Element element) { |
aoqi@0 | 1033 | final NamedNodeMap attributes = element.getAttributes(); |
aoqi@0 | 1034 | |
aoqi@0 | 1035 | return new Iterator() { |
aoqi@0 | 1036 | int attributesLength = attributes.getLength(); |
aoqi@0 | 1037 | int attributeIndex = 0; |
aoqi@0 | 1038 | String currentName; |
aoqi@0 | 1039 | |
aoqi@0 | 1040 | public boolean hasNext() { |
aoqi@0 | 1041 | return attributeIndex < attributesLength; |
aoqi@0 | 1042 | } |
aoqi@0 | 1043 | |
aoqi@0 | 1044 | public Object next() { |
aoqi@0 | 1045 | if (!hasNext()) { |
aoqi@0 | 1046 | throw new NoSuchElementException(); |
aoqi@0 | 1047 | } |
aoqi@0 | 1048 | Node current = attributes.item(attributeIndex++); |
aoqi@0 | 1049 | currentName = current.getNodeName(); |
aoqi@0 | 1050 | |
aoqi@0 | 1051 | String prefix = NameImpl.getPrefixFromTagName(currentName); |
aoqi@0 | 1052 | if (prefix.length() == 0) { |
aoqi@0 | 1053 | return NameImpl.createFromUnqualifiedName(currentName); |
aoqi@0 | 1054 | } else { |
aoqi@0 | 1055 | Name attributeName = |
aoqi@0 | 1056 | NameImpl.createFromQualifiedName( |
aoqi@0 | 1057 | currentName, |
aoqi@0 | 1058 | current.getNamespaceURI()); |
aoqi@0 | 1059 | return attributeName; |
aoqi@0 | 1060 | } |
aoqi@0 | 1061 | } |
aoqi@0 | 1062 | |
aoqi@0 | 1063 | public void remove() { |
aoqi@0 | 1064 | if (currentName == null) { |
aoqi@0 | 1065 | throw new IllegalStateException(); |
aoqi@0 | 1066 | } |
aoqi@0 | 1067 | attributes.removeNamedItem(currentName); |
aoqi@0 | 1068 | } |
aoqi@0 | 1069 | }; |
aoqi@0 | 1070 | } |
aoqi@0 | 1071 | |
aoqi@0 | 1072 | protected static String getAttributeValueFrom(Element element, Name name) { |
aoqi@0 | 1073 | return getAttributeValueFrom( |
aoqi@0 | 1074 | element, |
aoqi@0 | 1075 | name.getURI(), |
aoqi@0 | 1076 | name.getLocalName(), |
aoqi@0 | 1077 | name.getPrefix(), |
aoqi@0 | 1078 | name.getQualifiedName()); |
aoqi@0 | 1079 | } |
aoqi@0 | 1080 | |
aoqi@0 | 1081 | private static String getAttributeValueFrom( |
aoqi@0 | 1082 | Element element, |
aoqi@0 | 1083 | String uri, |
aoqi@0 | 1084 | String localName, |
aoqi@0 | 1085 | String prefix, |
aoqi@0 | 1086 | String qualifiedName) { |
aoqi@0 | 1087 | |
aoqi@0 | 1088 | String nonzeroLengthUri = |
aoqi@0 | 1089 | (uri == null || uri.length() == 0) ? null : uri; |
aoqi@0 | 1090 | |
aoqi@0 | 1091 | boolean mustUseGetAttributeNodeNS = (nonzeroLengthUri != null); |
aoqi@0 | 1092 | |
aoqi@0 | 1093 | if (mustUseGetAttributeNodeNS) { |
aoqi@0 | 1094 | |
aoqi@0 | 1095 | if (!element.hasAttributeNS(uri, localName)) { |
aoqi@0 | 1096 | return null; |
aoqi@0 | 1097 | } |
aoqi@0 | 1098 | |
aoqi@0 | 1099 | String attrValue = |
aoqi@0 | 1100 | element.getAttributeNS(nonzeroLengthUri, localName); |
aoqi@0 | 1101 | |
aoqi@0 | 1102 | return attrValue; |
aoqi@0 | 1103 | } |
aoqi@0 | 1104 | |
aoqi@0 | 1105 | Attr attribute = null; |
aoqi@0 | 1106 | attribute = element.getAttributeNode(qualifiedName); |
aoqi@0 | 1107 | |
aoqi@0 | 1108 | return attribute == null ? null : attribute.getValue(); |
aoqi@0 | 1109 | } |
aoqi@0 | 1110 | |
aoqi@0 | 1111 | protected static Iterator getChildElementsFrom(final Element element) { |
aoqi@0 | 1112 | return new Iterator() { |
aoqi@0 | 1113 | Node next = element.getFirstChild(); |
aoqi@0 | 1114 | Node nextNext = null; |
aoqi@0 | 1115 | Node last = null; |
aoqi@0 | 1116 | |
aoqi@0 | 1117 | public boolean hasNext() { |
aoqi@0 | 1118 | if (next != null) { |
aoqi@0 | 1119 | return true; |
aoqi@0 | 1120 | } |
aoqi@0 | 1121 | if (next == null && nextNext != null) { |
aoqi@0 | 1122 | next = nextNext; |
aoqi@0 | 1123 | } |
aoqi@0 | 1124 | |
aoqi@0 | 1125 | return next != null; |
aoqi@0 | 1126 | } |
aoqi@0 | 1127 | |
aoqi@0 | 1128 | public Object next() { |
aoqi@0 | 1129 | if (hasNext()) { |
aoqi@0 | 1130 | last = next; |
aoqi@0 | 1131 | next = null; |
aoqi@0 | 1132 | |
aoqi@0 | 1133 | if ((element instanceof ElementImpl) |
aoqi@0 | 1134 | && (last instanceof Element)) { |
aoqi@0 | 1135 | last = |
aoqi@0 | 1136 | ((ElementImpl) element).convertToSoapElement( |
aoqi@0 | 1137 | (Element) last); |
aoqi@0 | 1138 | } |
aoqi@0 | 1139 | |
aoqi@0 | 1140 | nextNext = last.getNextSibling(); |
aoqi@0 | 1141 | return last; |
aoqi@0 | 1142 | } |
aoqi@0 | 1143 | throw new NoSuchElementException(); |
aoqi@0 | 1144 | } |
aoqi@0 | 1145 | |
aoqi@0 | 1146 | public void remove() { |
aoqi@0 | 1147 | if (last == null) { |
aoqi@0 | 1148 | throw new IllegalStateException(); |
aoqi@0 | 1149 | } |
aoqi@0 | 1150 | Node target = last; |
aoqi@0 | 1151 | last = null; |
aoqi@0 | 1152 | element.removeChild(target); |
aoqi@0 | 1153 | } |
aoqi@0 | 1154 | }; |
aoqi@0 | 1155 | } |
aoqi@0 | 1156 | |
aoqi@0 | 1157 | public static String getQualifiedName(QName name) { |
aoqi@0 | 1158 | String prefix = name.getPrefix(); |
aoqi@0 | 1159 | String localName = name.getLocalPart(); |
aoqi@0 | 1160 | String qualifiedName = null; |
aoqi@0 | 1161 | |
aoqi@0 | 1162 | if (prefix != null && prefix.length() > 0) { |
aoqi@0 | 1163 | qualifiedName = prefix + ":" + localName; |
aoqi@0 | 1164 | } else { |
aoqi@0 | 1165 | qualifiedName = localName; |
aoqi@0 | 1166 | } |
aoqi@0 | 1167 | return qualifiedName; |
aoqi@0 | 1168 | } |
aoqi@0 | 1169 | |
aoqi@0 | 1170 | public static String getLocalPart(String qualifiedName) { |
aoqi@0 | 1171 | if (qualifiedName == null) { |
aoqi@0 | 1172 | // Log |
aoqi@0 | 1173 | throw new IllegalArgumentException("Cannot get local name for a \"null\" qualified name"); |
aoqi@0 | 1174 | } |
aoqi@0 | 1175 | |
aoqi@0 | 1176 | int index = qualifiedName.indexOf(':'); |
aoqi@0 | 1177 | if (index < 0) |
aoqi@0 | 1178 | return qualifiedName; |
aoqi@0 | 1179 | else |
aoqi@0 | 1180 | return qualifiedName.substring(index + 1); |
aoqi@0 | 1181 | } |
aoqi@0 | 1182 | |
aoqi@0 | 1183 | public static String getPrefix(String qualifiedName) { |
aoqi@0 | 1184 | if (qualifiedName == null) { |
aoqi@0 | 1185 | // Log |
aoqi@0 | 1186 | throw new IllegalArgumentException("Cannot get prefix for a \"null\" qualified name"); |
aoqi@0 | 1187 | } |
aoqi@0 | 1188 | |
aoqi@0 | 1189 | int index = qualifiedName.indexOf(':'); |
aoqi@0 | 1190 | if (index < 0) |
aoqi@0 | 1191 | return ""; |
aoqi@0 | 1192 | else |
aoqi@0 | 1193 | return qualifiedName.substring(0, index); |
aoqi@0 | 1194 | } |
aoqi@0 | 1195 | |
aoqi@0 | 1196 | protected boolean isNamespaceQualified(Name name) { |
aoqi@0 | 1197 | return !"".equals(name.getURI()); |
aoqi@0 | 1198 | } |
aoqi@0 | 1199 | |
aoqi@0 | 1200 | protected boolean isNamespaceQualified(QName name) { |
aoqi@0 | 1201 | return !"".equals(name.getNamespaceURI()); |
aoqi@0 | 1202 | } |
aoqi@0 | 1203 | |
aoqi@0 | 1204 | protected SOAPElement circumventBug5034339(SOAPElement element) { |
aoqi@0 | 1205 | |
aoqi@0 | 1206 | Name elementName = element.getElementName(); |
aoqi@0 | 1207 | if (!isNamespaceQualified(elementName)) { |
aoqi@0 | 1208 | String prefix = elementName.getPrefix(); |
aoqi@0 | 1209 | String defaultNamespace = getNamespaceURI(prefix); |
aoqi@0 | 1210 | if (defaultNamespace != null) { |
aoqi@0 | 1211 | Name newElementName = |
aoqi@0 | 1212 | NameImpl.create( |
aoqi@0 | 1213 | elementName.getLocalName(), |
aoqi@0 | 1214 | elementName.getPrefix(), |
aoqi@0 | 1215 | defaultNamespace); |
aoqi@0 | 1216 | SOAPElement newElement = createElement(newElementName); |
aoqi@0 | 1217 | replaceChild(newElement, element); |
aoqi@0 | 1218 | return newElement; |
aoqi@0 | 1219 | } |
aoqi@0 | 1220 | } |
aoqi@0 | 1221 | return element; |
aoqi@0 | 1222 | } |
aoqi@0 | 1223 | |
aoqi@0 | 1224 | //TODO: This is a temporary SAAJ workaround for optimizing XWS |
aoqi@0 | 1225 | // should be removed once the corresponding JAXP bug is fixed |
aoqi@0 | 1226 | // It appears the bug will be fixed in JAXP 1.4 (not by Appserver 9 timeframe) |
aoqi@0 | 1227 | public void setAttributeNS( |
aoqi@0 | 1228 | String namespaceURI,String qualifiedName, String value) { |
aoqi@0 | 1229 | int index = qualifiedName.indexOf(':'); |
aoqi@0 | 1230 | String localName; |
aoqi@0 | 1231 | if (index < 0) |
aoqi@0 | 1232 | localName = qualifiedName; |
aoqi@0 | 1233 | else |
aoqi@0 | 1234 | localName = qualifiedName.substring(index + 1); |
aoqi@0 | 1235 | |
aoqi@0 | 1236 | // Workaround for bug 6467808 - This needs to be fixed in JAXP |
aoqi@0 | 1237 | |
aoqi@0 | 1238 | // Rolling back this fix, this is a wrong fix, infact its causing other regressions in JAXWS tck and |
aoqi@0 | 1239 | // other tests, because of this change the namespace declarations on soapenv:Fault element are never |
aoqi@0 | 1240 | // picked up. The fix for bug 6467808 should be in JAXP. |
aoqi@0 | 1241 | // if(elementQName.getLocalPart().equals("Fault") && |
aoqi@0 | 1242 | // (SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(value) || |
aoqi@0 | 1243 | // SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(value))) |
aoqi@0 | 1244 | // return; |
aoqi@0 | 1245 | |
aoqi@0 | 1246 | super.setAttributeNS(namespaceURI,qualifiedName,value); |
aoqi@0 | 1247 | //String tmpLocalName = this.getLocalName(); |
aoqi@0 | 1248 | String tmpURI = this.getNamespaceURI(); |
aoqi@0 | 1249 | boolean isIDNS = false; |
aoqi@0 | 1250 | if( tmpURI != null && (tmpURI.equals(DSIG_NS) || tmpURI.equals(XENC_NS))){ |
aoqi@0 | 1251 | isIDNS = true; |
aoqi@0 | 1252 | } |
aoqi@0 | 1253 | //No need to check for Signature/encryption element |
aoqi@0 | 1254 | //just check for namespace. |
aoqi@0 | 1255 | if(localName.equals("Id")){ |
aoqi@0 | 1256 | if(namespaceURI == null || namespaceURI.equals("")){ |
aoqi@0 | 1257 | setIdAttribute(localName,true); |
aoqi@0 | 1258 | }else if(isIDNS || WSU_NS.equals(namespaceURI)){ |
aoqi@0 | 1259 | setIdAttributeNS(namespaceURI,localName,true); |
aoqi@0 | 1260 | } |
aoqi@0 | 1261 | } |
aoqi@0 | 1262 | |
aoqi@0 | 1263 | } |
aoqi@0 | 1264 | |
aoqi@0 | 1265 | } |