Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leading and trailing space in element name #46

Open
amarant opened this issue Jul 29, 2015 · 2 comments
Open

leading and trailing space in element name #46

amarant opened this issue Jul 29, 2015 · 2 comments

Comments

@amarant
Copy link

amarant commented Jul 29, 2015

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.

@highsource
Copy link
Owner

Could you please post a sample schema?

@amarant
Copy link
Author

amarant commented Jul 30, 2015

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants