469,913 Members | 1,976 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,913 developers. It's quick & easy.

Restricting the length of a CDATA section value.

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;

Expand|Select|Wrap|Line Numbers
  1. <DOC_CAT Attribute="Y"><![CDATA[AR]]></DOC_CAT>
The schema for this field currently looks like this;

Expand|Select|Wrap|Line Numbers
  1. <xs:element name="DOC_CAT">
  2.  <xs:complexType mixed="true">
  3.   <xs:attribute name="Attribute" use="required">
  4.    <xs:simpleType>
  5.     <xs:restriction base="xs:string">
  6.      <xs:enumeration value="Y"/>
  7.     </xs:restriction>
  8.    </xs:simpleType>
  9.   </xs:attribute>
  10.  </xs:complexType>
  11. </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
Sep 27 '05 #1
0 1997

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Cade Perkins | last post: by
10 posts views Thread by Simon Brooke | last post: by
2 posts views Thread by Steveino | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.