Skip to Content
Using XML with Legacy Business Applications
book

Using XML with Legacy Business Applications

by Michael C. Rawlins
August 2003
Intermediate to advanced content levelIntermediate to advanced
624 pages
15h 3m
English
Addison-Wesley Professional
Content preview from Using XML with Legacy Business Applications

Setting a Maximum Length

It is very common to see restrictions on the length of string Elements. To avoid truncating alphanumeric values before inserting them into a database, some programmers create schemas that make sure no one can use a string long enough to be truncated. To restrict our column lengths we can create a String1024Type type derived from string, as follows.

Setting a Maximum Length in SimpleCSV2.xsd
<xs:simpleType name="String1024Type">
  <xs:annotation>
    <xs:documentation>This user-defined type shows how we
        restrict our columns to 1024 characters
    </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:string">
    <xs:maxLength value="1024"/>
  </xs:restriction>
</xs:simpleType>

We use the xs:simpleType Element with its name ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning XML with C# 7: XML Processing and Data Access for C# Developers

Beginning XML with C# 7: XML Processing and Data Access for C# Developers

Bipin Joshi
XML Hacks

XML Hacks

Michael Fitzgerald
XML Unleashed

XML Unleashed

Michael Morrison
XML in a Nutshell, 3rd Edition

XML in a Nutshell, 3rd Edition

Elliotte Rusty Harold, W. Scott Means

Publisher Resources

ISBN: 0321154940Purchase book