Syd Bauman wrote:
> 
> 
> Might help, Rory, if you append a snippet of your schema and a tiny
> sample XML instance that is not valid against it, but that you
> thought would be.
> 
<snip>

Ok Syd

That's a good idea - below find (a really long post)- the schema (a 
snippet):

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"; 
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes";>
     <start>
         <element name="AdList">
             <oneOrMore>
                 <element name="Ad">
                     <attribute name="vertical" >
                         <value>Motors</value>
                     </attribute>
                     <!-- The tenant_reference must be unique per ad -->
                     <attribute name="tenant_reference">
                         <data type="positiveInteger">
                             <param name="totalDigits">9</param>
                         </data>
                     </attribute>
                     <attribute name="tenant_created_timestamp" >
                         <data type="dateTime" />
                     </attribute>
                     <attribute name="tenant_updated_timestamp" >
                         <data type="dateTime" />
                     </attribute>
                     <!-- The ad_start_timestamp is a placeholder for 
now, and may be ignored -->
                     <optional>
                         <attribute name="ad_start_timestamp">
                             <data type="dateTime" />
                         </attribute>
                     </optional>
                     <!-- The ad_end_timestamp is a placeholder for now, 
and may be ignored -->
                     <optional>
                         <attribute name="ad_end_timestamp">
                             <data type="dateTime" />
                         </attribute>
                     </optional>

                     <element name="TenantAdURL" >
                         <data type="token">
                             <param name="maxLength">255</param>
                         </data>
                     </element>

                     <element name="VehicleLocationCountry" >
                         <value>ZA</value>
                     </element>
                     <element name="VehicleLocationProvince" >
                         <choice>
                             <value>EC</value>
                             <value>FS</value>
                             <value>GT</value>
                             <value>NL</value>
                             <value>LP</value>
                             <value>MP</value>
                             <value>NC</value>
                             <value>NW</value>
                             <value>WC</value>
                         </choice>
                     </element>
                     <!-- Please refer to the IOLMotors/Property region 
library should you wish to include an area -->
                     <!-- If an area does not match an area in the 
library, this data will be silently ignored -->
                     <optional>
                         <element name="VehicleLocationArea" >
                             <data type="token">
                                 <param name="maxLength">100</param>
                             </data>
                         </element>
                     </optional>

                     <element name="AdHeadline" >
                         <data type="token">
                             <param name="maxLength">255</param>
                         </data>
                     </element>
                     <element name="AdShortDescription" >
                         <data type="token">
                             <param name="maxLength">255</param>
                         </data>
                     </element>
                     <!-- The long description may contain basic html -->
                     <optional>
                         <element name="AdLongDescription" >
                             <data type="string">
                                 <param name="maxLength">10000</param>
                             </data>
                         </element>
                     </optional>

                     <element name="VehicleType">
                         <choice>
                             <value>Car</value>
                             <value>Bike</value>
                             <value>Truck</value>
                         </choice>
                     </element>

.... And now a snippet of the file that fails to validate against the 
schema....


<?xml version="1.0" encoding="UTF-8"?>
<AdList>
     <Ad vertical="Motors" tenant_reference="123" 
tenant_created_timestamp="2008-05-02T21:26:00+02:00" 
tenant_updated_timestamp="2008-05-02T21:26:00+02:00">
         <TenantAdURL>http://blah.blah.com/123</TenantAdURL>
         <VehicleLocationCountry>ZA</VehicleLocationCountry>
         <VehicleLocationProvince>WC</VehicleLocationProvince>
         <AdHeadline>This is the head!</AdHeadline>
         <AdShortDescription>This is the short!!</AdShortDescription>
         <AdLongDescription>This is the long!!!</AdLongDescription>
         <VehicleType>Car</VehicleType>

.... and finally the error message...

fullhouse.xml:9:element AdLongDescription: Relax-NG validity error : 
Expecting element VehicleType, got AdLongDescription

Sorry for the long post, but this is an actual example ;)

Thanks in advance

Rory





Reply via email to