Author: dims Date: Wed Sep 13 21:46:10 2006 New Revision: 443228 URL: http://svn.apache.org/viewvc?view=rev&rev=443228 Log: Fixing problem that shows up here: http://issues.apache.org/jira/browse/AXIS2-1129#action_12434320
Basically if there is a single character prefix: xmlns:c="http://www.c-corp.com/schemas/c/schema_annotation" that becomes the default namespace. Also prevented multiple look ups on the hashmap by traversing the entry set. Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java?view=diff&rev=443228&r1=443227&r2=443228 ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java Wed Sep 13 21:46:10 2006 @@ -31,9 +31,9 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.util.ArrayList; -import java.util.Enumeration; import java.util.Hashtable; - +import java.util.Iterator; +import java.util.Map; public class XmlSchemaSerializer { private Hashtable schema_ns; @@ -284,14 +284,15 @@ Element schemaEl = createNewElement(schemaDocs, "schema", schemaObj.schema_ns_prefix, XmlSchema.SCHEMA_NS); - Enumeration keys = schema_ns.keys(); + Iterator entries = schema_ns.entrySet().iterator(); - while (keys.hasMoreElements()) { + while (entries.hasNext()) { //let it crash for null pointer because then either the schema //is wrong(namespace not set properly or bug in setting ns) - String key = keys.nextElement().toString(); - String value = schema_ns.get(key).toString(); - value = (value.length() > 1) ? "xmlns:" + value : "xmlns"; + Map.Entry entry = (Map.Entry) entries.next(); + String key = entry.getKey().toString(); + String value = entry.getValue().toString(); + value = (value.length() > 0) ? "xmlns:" + value : "xmlns"; schemaEl.setAttributeNS(XMLNS_NAMESPACE_URI, value, key); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
