-
Carriage return in complex type
I have a complex type like this
<xsd:element name="Work" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="Option" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="add"/>
<xsd:enumeration value="change"/>
<xsd:enumeration value="delete"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="Name" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="Number" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
The above schema validates the following two options correctly
<Work Option="add" Name="Raul" Number="7" />
<Work Option="add" Name="Raul" Number="7"></Work>
But if there is space or carriage return (Enter key) between the start and end tags, the schema returns an error
(ie) for
<Work Option="add" Name="Raul" Number="7"> </Work>
(&)
<Work Option="add" Name="Raul" Number="7">
</Work>
I get the following error message
(The content of element type "Work" must match "EMPTY".)
I tried using <xsd:whitespace> but I think it can be used only for simple types...
Can somebody help me out with this???
-
Validation will fail if the Work element contains any content. Change the declaration of the Work element so that it allows ANY or #PCDATA. That will let the element contain content, which is the cause of your problem right now. If in fact you don't want to allow the element to contain content, then the validation is working correctly as is.
A. Russell Jones,
Executive Editor,
Internet.com

Similar Threads
-
Replies: 3
Last Post: 08-01-2005, 05:59 AM
-
Replies: 1
Last Post: 03-27-2003, 11:49 AM
-
By Rob Teixeira in forum .NET
Replies: 129
Last Post: 06-06-2002, 05:23 AM
-
By Rob Teixeira in forum .NET
Replies: 15
Last Post: 05-31-2002, 03:30 PM
-
Replies: 1
Last Post: 04-23-2002, 03:54 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|