1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-28 07:21:26 +03:00

Changed xmlSchemaFormatIDCKeySequence() to use

* xmlschemas.c: Changed xmlSchemaFormatIDCKeySequence()
  to use xmlSchemaGetCanonValueWhtspExt() in order to
  correctly report values for xs:anySimpleType.
* test/schemas/idc-keyref-err1*
  result/schemas/idc-keyref-err1*: Added a test for this change.
This commit is contained in:
Kasimier T. Buchcik 2005-11-11 12:52:32 +00:00
parent a44f234d3a
commit 77e76829b6
6 changed files with 83 additions and 5 deletions

View File

@ -1,3 +1,11 @@
Fri Nov 11 13:48:52 CET 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xmlschemas.c: Changed xmlSchemaFormatIDCKeySequence()
to use xmlSchemaGetCanonValueWhtspExt() in order to
correctly report values for xs:anySimpleType.
* test/schemas/idc-keyref-err1*
result/schemas/idc-keyref-err1*: Added a test for this change.
Wed Nov 9 13:07:24 EST 2005 Rob Richards <rrichards@ctindustries.net>
* xmlIO.c xmlwriter.c: function consolidation when writing to xmlBuffer.

View File

@ -0,0 +1 @@
./test/schemas/idc-keyref-err1_0.xml fails to validate

View File

@ -0,0 +1 @@
./test/schemas/idc-keyref-err1_0.xml:12: Schemas validity error : Element '{urn:test:foo}Ref': No match found for key-sequence ['L4'] of keyref '{urn:test:foo}LinkKeyRef'.

View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<Foo
xmlns="urn:test:foo"
xmlns:foo="urn:test:foo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:test:foo idc-keyref_1.xsd">
<Def>
<Link foo:linkKey="L4"/>
</Def>
<Ref foo:linkRef="L4"/>
</Foo>

View File

@ -0,0 +1,53 @@
<?xml version="1.0"?>
<xs:schema
targetNamespace="urn:test:foo"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:foo="urn:test:foo"
elementFormDefault="qualified"
attributeFormDefault="qualified">
<xs:element name="Link">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="linkKey" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<!-- -->
<xs:element name="Foo">
<xs:complexType>
<xs:sequence>
<xs:element name="Def">
<xs:complexType>
<xs:sequence>
<xs:element ref="foo:Link"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Ref">
<xs:complexType>
<xs:attribute name="linkRef" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:key name="LinkKey">
<xs:selector xpath=".//foo:Link | .//foo:Link"/>
<xs:field xpath="@foo:linkKey"/>
</xs:key>
<xs:keyref name="LinkKeyRef" refer="foo:LinkKey">
<xs:selector xpath=".//foo:Ref"/>
<xs:field xpath="@foo:linkRef"/>
</xs:keyref>
</xs:element>
</xs:schema>

View File

@ -22156,15 +22156,16 @@ xmlSchemaFormatIDCKeySequence(xmlSchemaValidCtxtPtr vctxt,
int count)
{
int i, res;
const xmlChar *value = NULL;
xmlChar *value = NULL;
*buf = xmlStrdup(BAD_CAST "[");
for (i = 0; i < count; i++) {
*buf = xmlStrcat(*buf, BAD_CAST "'");
res = xmlSchemaGetCanonValueWhtsp(seq[i]->val, &value,
xmlSchemaGetWhiteSpaceFacetValue(seq[i]->type));
res = xmlSchemaGetCanonValueWhtspExt(seq[i]->val,
xmlSchemaGetWhiteSpaceFacetValue(seq[i]->type),
&value);
if (res == 0)
*buf = xmlStrcat(*buf, value);
*buf = xmlStrcat(*buf, BAD_CAST value);
else {
VERROR_INT("xmlSchemaFormatIDCKeySequence",
"failed to compute a canonical value");
@ -22175,7 +22176,7 @@ xmlSchemaFormatIDCKeySequence(xmlSchemaValidCtxtPtr vctxt,
else
*buf = xmlStrcat(*buf, BAD_CAST "'");
if (value != NULL) {
xmlFree((xmlChar *) value);
xmlFree(value);
value = NULL;
}
}