diff --git a/ChangeLog b/ChangeLog index 3e1dfb4e..04b51af0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Mar 5 01:13:22 CET 2004 Daniel Veillard + + * xmlschemas.c: QName handling fixes for the XML Schemas + support from Adam Dickmeiss + * test/schemas/po1_0.xsd: also fix the schemas + * test/schemas/ns[12]* result/schemas/ns[12]*: added the specific + regression tests + Thu Mar 4 23:03:02 CET 2004 Daniel Veillard * configure.in doc/Makefile.am include/libxml/Makefile.am: diff --git a/result/schemas/ns1_0_0 b/result/schemas/ns1_0_0 new file mode 100644 index 00000000..ffcfb6cb --- /dev/null +++ b/result/schemas/ns1_0_0 @@ -0,0 +1 @@ +./test/schemas/ns1_0.xml validates diff --git a/result/schemas/ns1_0_0.err b/result/schemas/ns1_0_0.err new file mode 100644 index 00000000..e69de29b diff --git a/result/schemas/ns2_0_0 b/result/schemas/ns2_0_0 new file mode 100644 index 00000000..b2c181e7 --- /dev/null +++ b/result/schemas/ns2_0_0 @@ -0,0 +1 @@ +./test/schemas/ns2_0.xml validates diff --git a/result/schemas/ns2_0_0.err b/result/schemas/ns2_0_0.err new file mode 100644 index 00000000..e69de29b diff --git a/test/schemas/ns1_0.xml b/test/schemas/ns1_0.xml new file mode 100644 index 00000000..410ed26a --- /dev/null +++ b/test/schemas/ns1_0.xml @@ -0,0 +1,2 @@ +some diff --git a/test/schemas/ns1_0.xsd b/test/schemas/ns1_0.xsd new file mode 100644 index 00000000..a77ec57e --- /dev/null +++ b/test/schemas/ns1_0.xsd @@ -0,0 +1,3 @@ + + + diff --git a/test/schemas/ns2_0.xml b/test/schemas/ns2_0.xml new file mode 100644 index 00000000..c3bb1269 --- /dev/null +++ b/test/schemas/ns2_0.xml @@ -0,0 +1 @@ +content diff --git a/test/schemas/ns2_0.xsd b/test/schemas/ns2_0.xsd new file mode 100644 index 00000000..9393beb2 --- /dev/null +++ b/test/schemas/ns2_0.xsd @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/test/schemas/po1_0.xsd b/test/schemas/po1_0.xsd index 81ffd448..84f45a71 100644 --- a/test/schemas/po1_0.xsd +++ b/test/schemas/po1_0.xsd @@ -17,7 +17,7 @@ Purchase order schema for Example.com. - + @@ -48,7 +48,7 @@ Purchase order schema for Example.com. - + diff --git a/xmlschemas.c b/xmlschemas.c index 2266f497..3a3602f0 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -1492,6 +1492,13 @@ xmlGetQNameProp(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, if (val == NULL) return (NULL); + if (!strchr(val, ':')) { + ns = xmlSearchNs(node->doc, node, 0); + if (ns) { + *namespace = xmlDictLookup(ctxt->dict, ns->href, -1); + return (val); + } + } ret = xmlSplitQName3(val, &len); if (ret == NULL) { return (val); @@ -2006,8 +2013,6 @@ xmlSchemaParseAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, "Attribute has no name nor ref\n", NULL, NULL); return (NULL); } - if (refNs == NULL) - refNs = schema->targetNamespace; snprintf(buf, 99, "anonattr %d", ctxt->counter++ + 1); name = (const xmlChar *) buf; ret = xmlSchemaAddAttribute(ctxt, schema, name, NULL); @@ -2027,8 +2032,6 @@ xmlSchemaParseAttribute(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, (xmlStrEqual(ret->targetNamespace, schema->targetNamespace))) ret->flags |= XML_SCHEMAS_ATTR_NSDEFAULT; ret->typeName = xmlGetQNameProp(ctxt, node, "type", &(ret->typeNs)); - if ((ret->typeName != NULL) && (ret->typeNs == NULL)) - ret->typeNs = schema->targetNamespace; ret->node = node; child = node->children; if (IS_SCHEMA(child, "annotation")) { @@ -2084,8 +2087,6 @@ xmlSchemaParseAttributeGroup(xmlSchemaParserCtxtPtr ctxt, NULL); return (NULL); } - if (refNs == NULL) - refNs = schema->targetNamespace; snprintf(buf, 99, "anonattrgroup %d", ctxt->counter++ + 1); name = (const xmlChar *) buf; if (name == NULL) { @@ -2177,8 +2178,6 @@ xmlSchemaParseElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, "Element has no name nor ref\n", NULL, NULL); return (NULL); } - if (refNs == NULL) - refNs = schema->targetNamespace; snprintf(buf, 99, "anonelem %d", ctxt->counter++ + 1); name = (const xmlChar *) buf; ret = xmlSchemaAddElement(ctxt, schema, name, NULL); @@ -2209,8 +2208,6 @@ xmlSchemaParseElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, ret->id = xmlSchemaGetProp(ctxt, node, "id"); ret->namedType = xmlGetQNameProp(ctxt, node, "type", &(ret->namedTypeNs)); - if ((ret->namedType != NULL) && (ret->namedTypeNs == NULL)) - ret->namedTypeNs = schema->targetNamespace; ret->substGroup = xmlGetQNameProp(ctxt, node, "substitutionGroup", &(ret->substGroupNs)); @@ -2345,8 +2342,6 @@ xmlSchemaParseList(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, type->type = XML_SCHEMA_TYPE_LIST; type->id = xmlSchemaGetProp(ctxt, node, "id"); type->ref = xmlGetQNameProp(ctxt, node, "ref", &(type->refNs)); - if ((type->ref != NULL) && (type->refNs == NULL)) - type->refNs = schema->targetNamespace; child = node->children; if (IS_SCHEMA(child, "annotation")) {