Data types

<--250*250-->

Last but not least (in this RELAX NG crash course, at least), you can type your data in RELAX NG, using the data element. Here’s the definition of a point type, from the RELAX NG tutorial, for example:

<element name="point" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">   <element name="x">     <data type="double"/>   </element>   <element name="y">     <data type="double"/>   </element> </element>

When you use the string data type (instead of the <text/> tag) for an element, you have to specify the length allowed as well; for this reason, only use the string data type when you have a maximum length in mind:

<element name="email">   <data type="string">     <param name=”maxLength”>127</param>   </data> </element>

That’s not much on RELAX NG, but it’s plenty to help you get started. As mentioned earlier, RELAX NG by Eric van der Vlist (O’Reilly) is available for a more in-depth look at the schema language.

<--336*280--->

Leave a Reply