jsonix-schema-compiler
jsonix-schema-compiler copied to clipboard
leading and trailing space in element name
Hi, I've got a schema with a trailing space in an element name, this is valid XSD, so when I test a round trip marshaling on it, it throws an error when marshaling back in the function writeStartElement when executing :
element = this.document.createElementNS(namespaceURI, qualifiedName);
because qualifiedName
ends with a space.
According to the XSD spec :
If the attribute type is not CDATA, then the XML processor MUST further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by a single space (#x20) character.
I think it is the role of the schema compiler to trim the attribute name. So the mapping file would contain the trimmed names. But maybe a trim in the js part would be useful too.
Thanks for your great work on this library.
Could you please post a sample schema?
A simple example with a trailing space in the element name :
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="note ">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>