Changed non-prefixed QNames to be bound to a default namespace if
* xmlschemastypes.c: Changed non-prefixed QNames to be bound to a
default namespace if existent.
diff --git a/ChangeLog b/ChangeLog
index 6970d6c..3877489 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 9 16:51:31 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+ * xmlschemastypes.c: Changed non-prefixed QNames to be bound to a
+ default namespace if existent.
+
Thu Jun 9 15:11:38 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xmlschemastypes.c: Fixed a bug which I invented: hexBinary's string
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 7f14168..3e751ff 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -2489,47 +2489,46 @@
}
goto done;
case XML_SCHEMAS_QNAME:{
- xmlChar *uri = NULL;
+ const xmlChar *uri = NULL;
xmlChar *local = NULL;
ret = xmlValidateQName(value, 1);
- if ((ret == 0) && (node != NULL)) {
+ if (ret != 0)
+ goto done;
+ if (node != NULL) {
xmlChar *prefix;
+ xmlNsPtr ns;
local = xmlSplitQName2(value, &prefix);
- if (prefix != NULL) {
- xmlNsPtr ns;
-
- ns = xmlSearchNs(node->doc, node, prefix);
- if (ns == NULL)
- ret = 1;
- else if (val != NULL)
- uri = xmlStrdup(ns->href);
- }
- if ((local != NULL) && ((val == NULL) || (ret != 0)))
- xmlFree(local);
+ ns = xmlSearchNs(node->doc, node, prefix);
+ if ((ns == NULL) && (prefix != NULL)) {
+ xmlFree(prefix);
+ if (local != NULL)
+ xmlFree(local);
+ goto return1;
+ }
+ if (ns != NULL)
+ uri = ns->href;
if (prefix != NULL)
xmlFree(prefix);
}
- if ((ret == 0) && (val != NULL)) {
+ if (val != NULL) {
v = xmlSchemaNewValue(XML_SCHEMAS_QNAME);
- if (v != NULL) {
- if (local != NULL)
- v->value.qname.name = local;
- else
- v->value.qname.name = xmlStrdup(value);
- if (uri != NULL)
- v->value.qname.uri = uri;
-
- *val = v;
- } else {
- if (local != NULL)
- xmlFree(local);
- if (uri != NULL)
- xmlFree(uri);
- goto error;
- }
- }
+ if (v == NULL) {
+ if (local != NULL)
+ xmlFree(local);
+ goto error;
+ }
+ if (local != NULL)
+ v->value.qname.name = local;
+ else
+ v->value.qname.name = xmlStrdup(value);
+ if (uri != NULL)
+ v->value.qname.uri = xmlStrdup(uri);
+ *val = v;
+ } else
+ if (local != NULL)
+ xmlFree(local);
goto done;
}
case XML_SCHEMAS_NCNAME: