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" />
Welbog
  • 59,154
  • 9
  • 110
  • 123
JimDel
  • 4,309
  • 11
  • 54
  • 99

2 Answers2

7

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
  • 59,154
  • 9
  • 110
  • 123
2

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.
  • 15,757
  • 4
  • 50
  • 58