/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class ElementImpl
implements SOAPElement, SOAPBodyElement {
public static final String WSU_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd".intern();
"com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
/**
* XML Information Set REC
* all namespace attributes (including those named xmlns,
* whose [prefix] property has no value) have a namespace URI of http://www.w3.org/2000/xmlns/
*/
/**
* The XML Namespace ("http://www.w3.org/XML/1998/namespace"). This is
* the Namespace URI that is automatically mapped to the "xml" prefix.
*/
super(
name.getLocalName());
}
super(
name.getLocalPart());
elementQName = name;
}
public ElementImpl(
}
try {
} catch (SOAPException e) { /*ignore*/
}
}
}
((SOAPDocument) super.getOwnerDocument());
if (ownerSOAPDocument == null) {
return null;
}
return ownerSOAPDocument.getDocument();
}
return addElement(name);
}
return addElement(qname);
}
return (SOAPElement) addChildElement(
}
throws SOAPException {
"SAAJ0101.impl.parent.of.body.elem.mustbe.body",
throw new SOAPExceptionImpl(
"Unable to locate namespace for prefix " + prefix);
}
}
return XMLNS_URI;
}
return XML_URI;
}
while (currentAncestor != null &&
!(currentAncestor instanceof Document)) {
if (currentAncestor instanceof ElementImpl) {
/*
if (prefix.equals(name.getPrefix())) {
String uri = name.getNamespaceURI();
if ("".equals(uri)) {
return null;
}
else {
return uri;
}
}*/
XMLNS_URI, "xmlns")) {
XMLNS_URI, "xmlns");
return null;
else {
return uri;
}
}
}
}
// Find if there's an ancester whose name contains this prefix
// String uri = currentAncestor.lookupNamespaceURI(prefix);
// return uri;
while (currentAncestor != null &&
!(currentAncestor instanceof Document)) {
/* if (prefix.equals(currentAncestor.getPrefix())) {
String uri = currentAncestor.getNamespaceURI();
// this is because the javadoc says getNamespaceURI() is not a computed value
// and URI for a non-empty prefix cannot be null
if (uri != null)
return uri;
}*/
//String uri = currentAncestor.lookupNamespaceURI(prefix);
//if (uri != null) {
// return uri;
//}
}
}
}
return null;
}
return replaceElementWithSOAPElement(this,copy);
}
throws SOAPException {
throw new SOAPException("Unable to locate namespace for prefix "
+ prefix);
}
}
while (eachNamespace.hasNext()) {
return "";
else
return candidatePrefix;
}
}
// Find if any of the ancestors' name has this uri
while (currentAncestor != null &&
!(currentAncestor instanceof Document)) {
return currentAncestor.getPrefix();
}
return null;
}
while (eachNamespace.hasNext()) {
return namespaceDecl;
} else {
return namespaceDecl;
}
}
return null;
}
return getNamespaceContextNodes(true);
}
return new NamespaceContextIterator(this, traverseStack);
}
throws SOAPException {
return convertToSoapElement(newElement);
}
throws SOAPException {
// check if Element falls in SOAP 1.1 or 1.2 namespace.
throw new SOAPExceptionImpl(
"Cannot add fragments which contain elements "
+ "which are in the SOAP namespace");
}
}
}
// if body is not empty throw an exception
throw new SOAPExceptionImpl("SOAP Version mismatch encountered when trying to add SOAPFault to SOAPBody");
}
throw new SOAPExceptionImpl("Cannot add SOAPFault as a child of a non-Empty SOAPBody");
}
}
}
// preserve the encodingStyle attr as it may get lost in the import
if (encodingStyle != null)
return convertToSoapElement(importedElement);
}
} else {
return element;
}
}
return circumventBug5034339(newElement);
}
return circumventBug5034339(newElement);
}
if (isNamespaceQualified(name)) {
return (SOAPElement)
name.getQualifiedName());
} else {
return (SOAPElement)
}
}
if (isNamespaceQualified(name)) {
return (SOAPElement)
} else {
return (SOAPElement)
}
}
if (getOwnerDocument() instanceof DocumentFragment)
return;
if (newElement instanceof ElementImpl) {
}
}
}
return child;
}
}
return null;
}
return addCDATA(
}
return this;
}
return this;
}
throws SOAPException {
}
return this;
}
throws SOAPException {
}
return this;
}
value);
}
value);
}
private void addAttributeBare(
}
} else {
}
}
throws SOAPException {
} else {
}
//Fix for CR:6474641
//tryToFindEncodingStyleAttributeName();
return this;
}
return getAttributeValueFrom(this, name);
}
return getAttributeValueFrom(
this,
}
Iterator i = getAllAttributesFrom(this);
while (i.hasNext()) {
}
}
Iterator i = getAllAttributesFrom(this);
while (i.hasNext()) {
}
}
}
return doGetNamespacePrefixes(false);
}
return doGetNamespacePrefixes(true);
}
return new Iterator() {
void findNext() {
}
}
}
public boolean hasNext() {
findNext();
}
findNext();
throw new NoSuchElementException();
}
return last;
}
public void remove() {
throw new IllegalStateException();
}
}
};
}
}
return elementQName;
}
}
}
return false;
}
return true;
}
if (declaration == null) {
return false;
}
try {
} catch (DOMException de) {
// ignore
}
return true;
}
return getChildElementsFrom(this);
}
if (element instanceof SOAPElement) {
return (SOAPElement) element;
} else {
return replaceElementWithSOAPElement(
}
}
ElementImpl copy) {
while (eachAttribute.hasNext()) {
}
}
} // XXX else throw an exception?
return copy;
}
return new Iterator() {
public boolean hasNext() {
if (node instanceof SOAPElement) {
break;
}
}
}
}
if (hasNext()) {
return last;
}
throw new NoSuchElementException();
}
public void remove() {
throw new IllegalStateException();
}
}
};
}
}
}
return new Iterator() {
public boolean hasNext() {
while (eachElement.hasNext()) {
break;
}
}
}
}
if (!hasNext()) {
throw new NoSuchElementException();
}
return last;
}
public void remove() {
throw new IllegalStateException();
}
}
};
}
public void removeContents() {
while (currentChild != null) {
} else {
}
}
currentChild = temp;
}
}
try {
} catch (JaxmURI.MalformedURIException m) {
"SAAJ0105.impl.encoding.style.mustbe.valid.URI",
new String[] { encodingStyle });
throw new IllegalArgumentException(
}
}
}
if (encodingStyle != null)
return encodingStyle;
if (soapNamespace != null) {
try {
} catch (SOAPException se) {
// has to be ignored
}
return encodingStyle;
}
}
return null;
}
// Node methods
}
} else {
try {
} catch (SOAPException e) {
throw new RuntimeException(e.getMessage());
}
}
}
return node;
} else {
throw new IllegalStateException();
}
}
return null;
}
Iterator i = getChildElements();
while (i.hasNext()) {
// TODO: Hack to fix text node split into multiple lines.
normalize();
// Should remove the normalization step when this gets fixed in
}
}
return null;
}
throw new SOAPException("Cannot pass NULL to setParentElement");
}
element.addChildElement(this);
}
if (soapNamespace != null) {
if (soapNamespacePrefix != null) {
}
}
}
protected void setEncodingStyleNamespace(
throws SOAPException {
"encodingStyle",
}
if (parentNode instanceof SOAPDocument) {
return null;
}
return (SOAPElement) parentNode;
}
SOAPElement antecedent = this;
while (antecedent != null) {
break;
}
}
return soapNamespace;
}
public void detachNode() {
parent.removeChild(this);
}
// Fix for CR: 6474641
//tryToFindEncodingStyleAttributeName();
}
public void tryToFindEncodingStyleAttributeName() {
try {
} catch (SOAPException e) { /*okay to fail*/
}
}
public void recycleNode() {
detachNode();
// TBD
// - add this to the factory so subsequent
// creations can reuse this object.
}
class AttributeManager {
}
public void clearName() {
}
}
return attributeName;
}
return attributeValue;
}
/** Note: to be used only in detachNode method */
public void clearNameAndValue() {
}
if (attributeName != null) {
if (attributeValue != null) {
}
}
}
private void clearAttribute() {
if (attributeName != null) {
}
}
}
while (eachNamespace.hasNext()) {
return namespaceDecl;
}
}
return null;
}
return new Iterator() {
int attributeIndex = 0;
public boolean hasNext() {
return attributeIndex < attributesLength;
}
if (!hasNext()) {
throw new NoSuchElementException();
}
} else {
return attributeName;
}
}
public void remove() {
if (currentName == null) {
throw new IllegalStateException();
}
}
};
}
return getAttributeValueFrom(
name.getLocalName(),
name.getQualifiedName());
}
if (mustUseGetAttributeNodeNS) {
return null;
}
return attrValue;
}
}
return new Iterator() {
public boolean hasNext() {
return true;
}
}
}
if (hasNext()) {
if ((element instanceof ElementImpl)
last =
}
return last;
}
throw new NoSuchElementException();
}
public void remove() {
throw new IllegalStateException();
}
}
};
}
} else {
}
return qualifiedName;
}
if (qualifiedName == null) {
// Log
throw new IllegalArgumentException("Cannot get local name for a \"null\" qualified name");
}
if (index < 0)
return qualifiedName;
else
}
if (qualifiedName == null) {
// Log
throw new IllegalArgumentException("Cannot get prefix for a \"null\" qualified name");
}
if (index < 0)
return "";
else
}
}
}
if (!isNamespaceQualified(elementName)) {
if (defaultNamespace != null) {
return newElement;
}
}
return element;
}
//TODO: This is a temporary SAAJ workaround for optimizing XWS
// should be removed once the corresponding JAXP bug is fixed
// It appears the bug will be fixed in JAXP 1.4 (not by Appserver 9 timeframe)
public void setAttributeNS(
if (index < 0) {
}
else {
}
// Workaround for bug 6467808 - This needs to be fixed in JAXP
// Rolling back this fix, this is a wrong fix, infact its causing other regressions in JAXWS tck and
// other tests, because of this change the namespace declarations on soapenv:Fault element are never
// picked up. The fix for bug 6467808 should be in JAXP.
// if(elementQName.getLocalPart().equals("Fault") &&
// (SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(value) ||
// SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(value)))
// return;
//String tmpLocalName = this.getLocalName();
boolean isIDNS = false;
isIDNS = true;
}
//No need to check for Signature/encryption element
//just check for namespace.
setIdAttribute(localName,true);
}
}
}
}