You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by gd...@apache.org on 2005/10/20 15:20:44 UTC
svn commit: r326899 -
/webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
Author: gdaniels
Date: Thu Oct 20 06:20:39 2005
New Revision: 326899
URL: http://svn.apache.org/viewcvs?rev=326899&view=rev
Log:
Fix namespace problems when converting to DOM - make sure we actually declare the ns on the emitted element.
Modified:
webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
Modified: webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java?rev=326899&r1=326898&r2=326899&view=diff
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java (original)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java Thu Oct 20 06:20:39 2005
@@ -192,7 +192,11 @@
}
/**
- * Method toDOM.
+ * Method toDOM. This will create a DOM element in the supplied document
+ * containing the XML-ized EPR. A namespace declaration for WSA will be
+ * added to this element, using either the default namespace (if the
+ * passed elementName isn't prefixed) or a prefixed namespace (if it is
+ * of the form "foo:bar").
*
* @param doc
* @param elementName
@@ -206,8 +210,26 @@
}
}
- Element parent = doc.createElementNS(AddressingUtils.getAddressingNamespaceURI(),
- elementName);
+ int ix = elementName.indexOf(":");
+ String prefix = "";
+ if (ix != -1) {
+ prefix = elementName.substring(0, ix);
+ }
+
+ String ns = AddressingUtils.getAddressingNamespaceURI();
+ Element parent = doc.createElementNS(ns, elementName);
+
+ // Add namespace declaration
+ if (prefix.equals("")) {
+ parent.setAttributeNS(org.apache.axis.Constants.NS_URI_XMLNS,
+ "xmlns", ns);
+ } else {
+ parent.setAttributeNS(org.apache.axis.Constants.NS_URI_XMLNS,
+ "xmlns:" + prefix, ns);
+ prefix = prefix + ":"; // Now we just use this to make qnames...
+ }
+
+ // !!! Shouldn't we let the user decide where to put it?? --gdaniels
if (doc.getDocumentElement() == null) {
doc.appendChild(parent);
} else {
@@ -215,17 +237,17 @@
}
if (getAddress() != null) {
- getAddress().append(parent, Constants.ADDRESS);
+ getAddress().append(parent, prefix + Constants.ADDRESS);
}
if (getPortType() != null) {
- getPortType().append(parent, Constants.PORT_TYPE);
+ getPortType().append(parent, prefix + Constants.PORT_TYPE);
}
if (getServiceName() != null) {
- getServiceName().append(parent, Constants.SERVICE_NAME);
+ getServiceName().append(parent, prefix + Constants.SERVICE_NAME);
}
ReferencePropertiesType refProps = getProperties();
if (refProps != null && refProps.size() > 0) {
- refProps.append(parent, Constants.REFERENCE_PROPERTIES);
+ refProps.append(parent, prefix + Constants.REFERENCE_PROPERTIES);
}
MessageElement [] any = get_any();
if (any != null && any.length > 0) {
---------------------------------------------------------------------
To unsubscribe, e-mail: addressing-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: addressing-dev-help@ws.apache.org