At 2008-05-06 21:33 +0200, Rory McKinley wrote:
>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):
>...
>.... And now a snippet of the file that fails to validate against the
>schema....
>...
>.... 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 ;)

Which processor are you using?  Jing version 20030619 accepts your 
instance without error (see below).

I hope this helps.

. . . . . . . . . . . . Ken

T:\ftemp>type rory.rng
<?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>
                    </element>
                  </oneOrMore>
                </element>
              </start>
            </grammar>

T:\ftemp>type rory.xml
<?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>
        </Ad>
      </AdList>

T:\ftemp>call jing rory.rng rory.xml

T:\ftemp>type rorybad.xml
<?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>
          <HelloWorld/>
        </Ad>
      </AdList>

T:\ftemp>call jing rory.rng rorybad.xml
T:\ftemp\rorybad.xml:13:23: error: unknown element "HelloWorld"

T:\ftemp>rem Done!


--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:[EMAIL PROTECTED]
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/r/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/r/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Reply via email to