xs:NCName

Sep 9, 2010 at 9:14 PM

I am using a schema that has attributes with a data type of xs:NCName. Serializing these attributes encodes the spaces in the attribute value. An attribute with a value of "Output 1" serializes as "Output_x0020_1". Is this an Xsd2Code issue, MS serialization issue or is this correct for xs:NCName attribute data types? if the data type is string then the space does not get encoded.

Is this the correct behavior? Is this a bug? If so, what software is causing it?

 

Thanks

Sep 9, 2010 at 9:26 PM

I think I found the answer to my question. It looks like "no spaces" is part of the specification.

Here's what I found on another forum: (https://collada.org/public_forum/viewtopic.php?f=12&t=514&start=0)

"NCName The XSLT specification describes many components of XSLT syntax as "NCNames," a term that comes from the W3C namespace specification. To simplify a little, an NCName is any name that begins with a letter or underscore and has no space or colon in it ("NC" = "No Colon" ). It can't have a colon because it may have a namespace prefix added to its beginning, and namespace prefixes themselves are also defined as NCNames. Because the prefix and the part after it are connected by a colon, a colon within these names would confuse a processor trying to figure out where the prefix ended and the other part began, so they both must be "No Colon" names. See also "QName.""

Thanks for looking.