Could someone familiar with ws-commons XmlSchema look at this?
org.apache.ws.commons.schema.XmlSchemaException: No namespace found in
given base simple content type
at
org.apache.ws.commons.schema.SchemaBuilder.handleSimpleContentExtension(SchemaBuilder.java:769)
at
org.apache.ws.commons.schema.SchemaBuilder.handleSimpleContent(SchemaBuilder.java:644)
at
org.apache.ws.commons.schema.SchemaBuilder.handleComplexType(SchemaBuilder.java:577)
at
org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:96)
at
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:132)
The test case wsdl is http://www.uddi.org/schema/uddi_v2.xsd
The problem fragment is:
....
<xsd:complexType name="accessPoint">
<xsd:simpleContent>
<xsd:extension base="string">
The problem seems to be in the SchemaBuilder.handleSimpleContentExtension
method. It throws an exception because it expects the value of attribute
'base' to be explicitly prefixed (e.g. base="xsd:string") so it can look up
the namespace for the prefix.
if (extEl.hasAttribute("base")) {
String name = extEl.getAttribute("base"); <<name = "string"
String nsFromEl = Tokenizer.tokenize(name, ":")[0]; <<nsFromEl =
"string"
Object result = schema.namespaces.get(nsFromEl); <<result = null
Perhaps it should be similar to the handleSimpleType method's treatment of
the 'base' attribute ... let 'namespace' default to the empty string "" for
unprefixed values, which can then be used to look up the default namespace
for the schema (e.g. xmlns="http://www.w3.org/2001/XMLSchema")
if (restrictionEl.hasAttribute("base")) {
String name = restrictionEl.getAttribute("base");
String[] temp = Tokenizer.tokenize(name, ":");
String namespace = "";
if (temp.length != 1) {
namespace = temp[0]; <<use prefix if present,
otherwise use empty string
}
regards,
John Kaputin