tags:

views:

131

answers:

2

How do I add a space in an XML schema element? I'd like to have "Last Name" without using an underscore. Thanks.

<xs:element name="Last Name" type="xs:string" minOccurs="0" />
+7  A: 

You can't. That would go against the XML specification. The space character is used as a delimiter in XML and has special meaning. It cannot appear in element names.

Think about the resulting element that you would be defining with that declaration:

<Last Name attribute1="value" attribute2="value">Contents</Last Name>

That doesn't look anything like XML and would be rejected by any XML parser.

Welbog
You could do a dash: Last-Name.
Cheeso
Well Shoot. But thanks. :)
JimDel
+2  A: 

this schema represents an element in XML. Elements are not allowed to have white spaces in their names as they are used as a delimiter for attributes.

Stan R.