Hi all,
I have an XML file where all to elements for the data are contained in CDATA sections. I have a schema created that is working right now although it is pretty dumbed down. I have a need now to insert into the schema a restriction on the length of the values in the different elements.
The xml looks like this;
<DOCCAT Attribute="Y"><![CDATA[AR]]></DOCCAT>
The schema for this field currently looks like this;
<xs:element name="DOC_CAT">
<xs:complexType mixed="true">
<xs:attribute name="Attribute" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Y"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
I have tried putting a maxLength parameter just above the enumeration parameter, but nothing happens when I validate the xml with a field value that is longer than the maxLength parameter. My suspicion is that the maxLength parameter is being applied to the attribute field instead of the cdata section.
How can I apply a length restriction against the value in the cdata section?
Thanks for your help,
Doug Harding
State of Utah
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).