Hi,
I have an XML document with a schema defined in it. I try to make
libxml2 apply whitespace normalization as specified in the schema, but
it doesn't seem to work. Here is an example:
<contact xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance'>
<xsd:element name='contact' type='ContactType'>
<xsd:complexType name='ContactType'>
<xsd:choice>
<xsd:element name='customer' type='collString'/>
<xsd:element name='comment' type='collString'/>
</xsd:choice>
</xsd:complexType>
<xsd:simpleType name='collString'>
<xsd:restriction base='xsd:string'>
<xsd:whiteSpace value='collapse'/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<customer>Name </customer>
</contact>
The whitespace is preserved when I call xmlTextReaderConstValue(...),
even though <xsd:whiteSpace value='collapse'/> is specified.
Do I need to do something more to make this work, or can my application
ask whether the string can be collapsed?
PS: I did add a schema valid context created with a null pointer, like I
read somewhere:
xmlSchemaValidCtxtPtr validator = xmlSchemaNewValidCtxt(0);
xmlSchemaSetValidErrors(validator, SchemaValidityErrorFunc,
SchemaValidityErrorFunc, reader);
int rv = xmlTextReaderSchemaValidateCtxt(reader, validator, 0);
and rv is 0.
Regards,
--
Mark
_________________________________________
When you get lemons, you make lemonade.
When you get hardware, you make software.
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml