diff options
-rw-r--r-- | java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java b/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java index 082ce48fbd..c1978883df 100644 --- a/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java +++ b/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java @@ -159,11 +159,24 @@ public class SDOTypeHelper implements XMLTypeHelper { } // make sure all the required types are defined in the resolved schema for (Type type : entry.getValue()) { - QName typeName = new QName(type.getURI(), type.getName()); - if (resolved.getXmlSchemaType(typeName) == null) { - //FIXME: create a checked exception and propagate it back up to the activator - throw new RuntimeException("No XSD found for " + typeName.toString()); + String name = xsdHelper.getLocalName(type); + QName typeName = null; + if (name.endsWith("_._type")) { + // FIXME: Anonymous tyype + name = name.substring(0, name.length() - "_._type".length()); + typeName = new QName(type.getURI(), name); + if (resolved.getXmlSchemaElement(typeName) == null) { + //FIXME: create a checked exception and propagate it back up to the activator + throw new RuntimeException("No XSD found for " + typeName.toString()); + } + } else { + typeName = new QName(type.getURI(), name); + if (resolved.getXmlSchemaType(typeName) == null) { + //FIXME: create a checked exception and propagate it back up to the activator + throw new RuntimeException("No XSD found for " + typeName.toString()); + } } + } definitions.add(resolved); } |