diff options
Diffstat (limited to 'gnu/xml/validation/xmlschema/XMLSchemaBuilder.java')
-rw-r--r-- | gnu/xml/validation/xmlschema/XMLSchemaBuilder.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java b/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java index a7bad3129..3cfcfdedb 100644 --- a/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java +++ b/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java @@ -48,6 +48,7 @@ import org.relaxng.datatype.helpers.DatatypeLibraryLoader; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import gnu.xml.validation.datatype.Annotation; +import gnu.xml.validation.datatype.Facet; import gnu.xml.validation.datatype.SimpleType; import gnu.xml.validation.datatype.Type; @@ -525,10 +526,14 @@ class XMLSchemaBuilder throws DatatypeException { SimpleType type = (SimpleType) schema.types.get(typeName); + if (type != null) + return type; if (!XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(typeName.getNamespaceURI())) return null; String localName = typeName.getLocalPart(); - return (SimpleType) typeLibrary.createDatatype(localName); + type = (SimpleType) typeLibrary.createDatatype(localName); + schema.types.put(typeName, type); + return type; } SimpleType parseSimpleType(Node simpleType) @@ -549,10 +554,10 @@ class XMLSchemaBuilder typeFinal = getAttribute(schemaAttrs, "finalDefault"); } } - int typeFinality = parseSimpleTypeDerivationSet(typeFinal); + parseSimpleTypeDerivationSet(typeFinal); // TODO: Make use of typeFinality QName typeName = asQName(getAttribute(attrs, "name"), simpleType); int variety = 0; - Set facets = new LinkedHashSet(); + Set<Facet> facets = new LinkedHashSet<Facet>(); int fundamentalFacets = 0; // TODO SimpleType baseType = null; // TODO Annotation annotation = null; @@ -661,8 +666,7 @@ class XMLSchemaBuilder { NamedNodeMap attrs = restriction.getAttributes(); String base = getAttribute(attrs, "base"); - QName baseType = asQName(base, restriction); - SimpleType simpleType = null; + asQName(base, restriction); // TODO: make use of basetype for (Node child = restriction.getFirstChild(); child != null; child = child.getNextSibling()) { @@ -678,7 +682,7 @@ class XMLSchemaBuilder else if ("simpleType".equals(name)) { type.contentType = XMLSchema.CONTENT_SIMPLE; - simpleType = parseSimpleType(child); + parseSimpleType(child); // TODO: make use of SimpleType } else if ("minExclusive".equals(name)) { @@ -744,7 +748,7 @@ class XMLSchemaBuilder { NamedNodeMap attrs = extension.getAttributes(); String base = getAttribute(attrs, "base"); - QName baseType = asQName(base, extension); + asQName(base, extension); // TODO: make use of basetype for (Node child = extension.getFirstChild(); child != null; child = child.getNextSibling()) { |