[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
XML won't validate against schema
- From: Tim Greiner <majormit@WORLDNET.ATT.NET>
- To: Danny Ayers <danny@panlanka.net>, Xml-Dev <xml-dev@lists.xml.org>
- Date: Mon, 16 Apr 2001 12:46:14 -0400
The .xsd and .xml files are attached. XMLSpy says the xml file is not valid
because of mandatory elements 'name' and 'phone' in 'contact'. however those
elements are there and have data in them.
Thanks
Tim
Can you please post the schema & doc. Unless it's an instantly recognisable
XMLSpy bug, there's not a lot to go on here.
---
Danny Ayers
http://www.isacat.net
<- -----Original Message-----
<- From: Tim Greiner [mailto:majormit@WORLDNET.ATT.NET]
<- Sent: 16 April 2001 20:37
<- To: Xml-Dev
<- Subject: XML won't validate against schema
<-
<-
<- Hi all...newbie here trying to validate an xml doc against a
<- schema I built
<- with XMLSpy. The schema contains a required element with some
<- optional and
<- required children. However, the XMLSpy validator says the file
<- is not valid
<- (Mandatory elements expected in 'contact' after 'phone': name, phone)
<-
<- 'contact' is the reqd element and 'phone' and 'name' are the
<- reqd children
<- of contact. I have entered data in for name and phone but am
<- still getting
<- the not valid msg...anyone seen this?
<-
<- Thanks
<-
<- Tim
<-
<-
<- ------------------------------------------------------------------
<- The xml-dev list is sponsored by XML.org, an initiative of OASIS
<- <http://www.oasis-open.org>
<-
<- The list archives are at http://lists.xml.org/archives/xml-dev/
<-
<- To unsubscribe from this elist send a message with the single word
<- "unsubscribe" in the body to: xml-dev-request@lists.xml.org
<-
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by Tim Greiner (NBS) -->
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
<xsd:element name="tso_market">
<xsd:annotation>
<xsd:documentation>Container for TSO data</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="address" minOccurs="3" maxOccurs="3"/>
<xsd:element ref="detail_record" maxOccurs="10"/>
<xsd:element ref="date_time" minOccurs="2" maxOccurs="2"/>
<xsd:element ref="footage"/>
<xsd:element ref="discount"/>
<xsd:element ref="duration"/>
<xsd:element ref="comments" minOccurs="0"/>
<xsd:element ref="accessorial" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="address">
<xsd:annotation>
<xsd:documentation>Container for shipment addresses</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all>
<xsd:element ref="type"/>
<xsd:element name="handle" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="28"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="company_name">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="28"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="street1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="street2" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="city">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="30"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="state">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="2"/>
<xsd:minLength value="2"/>
<xsd:length value="2"/>
<xsd:whiteSpace value="collapse"/>
<xsd:enumeration value="AL"/>
<xsd:enumeration value="AK"/>
<xsd:enumeration value="AS"/>
<xsd:enumeration value="AR"/>
<xsd:enumeration value="AZ"/>
<xsd:enumeration value="CA"/>
<xsd:enumeration value="CO"/>
<xsd:enumeration value="CT"/>
<xsd:enumeration value="DE"/>
<xsd:enumeration value="DC"/>
<xsd:enumeration value="FL"/>
<xsd:enumeration value="GA"/>
<xsd:enumeration value="HI"/>
<xsd:enumeration value="ID"/>
<xsd:enumeration value="IL"/>
<xsd:enumeration value="IN"/>
<xsd:enumeration value="IA"/>
<xsd:enumeration value="KS"/>
<xsd:enumeration value="KY"/>
<xsd:enumeration value="LA"/>
<xsd:enumeration value="ME"/>
<xsd:enumeration value="MD"/>
<xsd:enumeration value="MA"/>
<xsd:enumeration value="MI"/>
<xsd:enumeration value="MN"/>
<xsd:enumeration value="MS"/>
<xsd:enumeration value="MO"/>
<xsd:enumeration value="MT"/>
<xsd:enumeration value="NE"/>
<xsd:enumeration value="NV"/>
<xsd:enumeration value="NH"/>
<xsd:enumeration value="NJ"/>
<xsd:enumeration value="NM"/>
<xsd:enumeration value="NY"/>
<xsd:enumeration value="NC"/>
<xsd:enumeration value="ND"/>
<xsd:enumeration value="OH"/>
<xsd:enumeration value="OK"/>
<xsd:enumeration value="OR"/>
<xsd:enumeration value="PA"/>
<xsd:enumeration value="RI"/>
<xsd:enumeration value="SC"/>
<xsd:enumeration value="SD"/>
<xsd:enumeration value="TN"/>
<xsd:enumeration value="TX"/>
<xsd:enumeration value="UT"/>
<xsd:enumeration value="VT"/>
<xsd:enumeration value="VA"/>
<xsd:enumeration value="WA"/>
<xsd:enumeration value="WV"/>
<xsd:enumeration value="WI"/>
<xsd:enumeration value="WY"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="zip">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="5"/>
<xsd:minLength value="5"/>
<xsd:whiteSpace value="collapse"/>
<xsd:pattern value="\d{5,5}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element ref="contact"/>
<xsd:element ref="dock_specs" minOccurs="0"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="contact">
<xsd:annotation>
<xsd:documentation>Contact information for an address</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all minOccurs="0">
<xsd:element name="name">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="28"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="title" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="28"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="phone">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="25"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="fax" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="25"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="tollfree" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="25"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="email" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
<xsd:whiteSpace value="collapse"/>
<xsd:pattern value="\S+@\S+\.\S+"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="detail_record">
<xsd:annotation>
<xsd:documentation>Items in the shipment</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all>
<xsd:element name="description">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="200"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="weight">
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="unit_type">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:enumeration value="bags"/>
<xsd:enumeration value="bails"/>
<xsd:enumeration value="bundles"/>
<xsd:enumeration value="cartons"/>
<xsd:enumeration value="coils"/>
<xsd:enumeration value="crates"/>
<xsd:enumeration value="drums"/>
<xsd:enumeration value="gaylords"/>
<xsd:enumeration value="pails"/>
<xsd:enumeration value="reels"/>
<xsd:enumeration value="rolls"/>
<xsd:enumeration value="rugs"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="num_units">
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element ref="pallets" minOccurs="0"/>
<xsd:element ref="hazmat" minOccurs="0"/>
<xsd:element ref="type_specific_attrs"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="pallets">
<xsd:annotation>
<xsd:documentation>Pallet info for a detail_record</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all>
<xsd:element name="number">
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:minInclusive value="1"/>
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="stackable">
<xsd:simpleType>
<xsd:restriction base="xsd:boolean">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="hazmat">
<xsd:annotation>
<xsd:documentation>Hazardous info for a detail_record</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all>
<xsd:element name="type">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="40"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="un_number">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="15"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="type_specific_attrs">
<xsd:annotation>
<xsd:documentation>Attributes for detail_record specific to TL/LTL</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice>
<xsd:element name="trailer_type">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="collapse"/>
<xsd:enumeration value="van"/>
<xsd:enumeration value="flatbed"/>
<xsd:enumeration value="reefer"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="nmfc_info">
<xsd:complexType>
<xsd:all>
<xsd:element name="subclass" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="9"/>
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="class">
<xsd:simpleType>
<xsd:restriction base="xsd:float">
<xsd:whiteSpace value="collapse"/>
<xsd:enumeration value="50"/>
<xsd:enumeration value="55"/>
<xsd:enumeration value="60"/>
<xsd:enumeration value="65"/>
<xsd:enumeration value="70"/>
<xsd:enumeration value="77.5"/>
<xsd:enumeration value="85"/>
<xsd:enumeration value="92.5"/>
<xsd:enumeration value="100"/>
<xsd:enumeration value="110"/>
<xsd:enumeration value="125"/>
<xsd:enumeration value="150"/>
<xsd:enumeration value="175"/>
<xsd:enumeration value="200"/>
<xsd:enumeration value="250"/>
<xsd:enumeration value="300"/>
<xsd:enumeration value="400"/>
<xsd:enumeration value="500"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="nmfc" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:maxInclusive value="999999"/>
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="dock_specs">
<xsd:annotation>
<xsd:documentation>Dock Specifications for an address</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all minOccurs="0">
<xsd:element name="dock_description" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="200"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="dock_height" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="10"/>
<xsd:pattern value="\d{0,2}-\d{0,2}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="max_trailer_length" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
<xsd:whiteSpace value="preserve"/>
<xsd:pattern value="\d{0,2}-\d{0,2}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="max_trailer_height" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
<xsd:whiteSpace value="preserve"/>
<xsd:pattern value="\d{0,2}-\d{0,2}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="date_time">
<xsd:annotation>
<xsd:documentation>Date and optional time for pickup/delivery</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all>
<xsd:element name="date">
<xsd:simpleType>
<xsd:restriction base="xsd:date">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="time">
<xsd:simpleType>
<xsd:restriction base="xsd:time">
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element ref="type"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="footage">
<xsd:annotation>
<xsd:documentation>Contains linear/cubic ft for detail_record</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice>
<xsd:element name="lin_ft">
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="cu_ft">
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="discount">
<xsd:annotation>
<xsd:documentation>Contains discount type and amount</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all>
<xsd:element name="discount_type">
<xsd:simpleType>
<xsd:restriction base="xsd:byte">
<xsd:whiteSpace value="collapse"/>
<xsd:enumeration value="$"/>
<xsd:enumeration value="%"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="discount_amount">
<xsd:simpleType>
<xsd:restriction base="xsd:decimal">
<xsd:whiteSpace value="collapse"/>
<xsd:precision value="2"/>
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="accessorial">
<xsd:annotation>
<xsd:documentation>Contains accessorials and costs for tso</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all maxOccurs="unbounded">
<xsd:element name="accessorial_description">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="200"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="accessorial_cost">
<xsd:simpleType>
<xsd:restriction base="xsd:decimal">
<xsd:precision value="2"/>
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="type">
<xsd:annotation>
<xsd:documentation>Type indicator for addresses/dates</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="collapse"/>
<xsd:enumeration value="orig"/>
<xsd:enumeration value="dest"/>
<xsd:enumeration value="billto"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="duration">
<xsd:simpleType>
<xsd:restriction base="xsd:timeDuration">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="comments">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="200"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by Tim Greiner (NBS) -->
<tso_market xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation="E:\MarketSuite15\Config\public_html\xml\tso_market.xsd">
<address>
<type>dest</type>
<company_name>asdf</company_name>
<street1>dest street1</street1>
<city>dest city</city>
<state>IL</state>
<zip>40474</zip>
<contact>
<name>dest contact name</name>
<phone>dest contact phone</phone>
</contact>
</address>
<address>
<type>orig</type>
<company_name>asdf</company_name>
<street1>orig street1</street1>
<city>city</city>
<state>AZ</state>
<zip>20832</zip>
<contact>
<name>orig name</name>
<phone>orig phone</phone>
</contact>
</address>
<address>
<type>billto</type>
<company_name>abc inc</company_name>
<street1>billto street1</street1>
<city>billto city</city>
<state>DC</state>
<zip>20202</zip>
<contact>
<name>billto contact name</name>
<phone>billto phone</phone>
</contact>
</address>
<detail_record>
<description>item 2</description>
<weight>800</weight>
<unit_type>rolls</unit_type>
<num_units>89</num_units>
<type_specific_attrs>
<nmfc_info>
<class>250</class>
<subclass>5</subclass>
</nmfc_info>
</type_specific_attrs>
</detail_record>
<detail_record>
<description>item 1</description>
<weight>5000</weight>
<unit_type>coils</unit_type>
<num_units>67</num_units>
<type_specific_attrs>
<nmfc_info>
<class>250</class>
</nmfc_info>
</type_specific_attrs>
</detail_record>
<date_time>
<date>01-01-2000</date>
<time/>
<type>orig</type>
</date_time>
<date_time>
<date>01-01-2000</date>
<time/>
<type>orig</type>
</date_time>
<footage>
<cu_ft>500</cu_ft>
</footage>
<discount>
<discount_type>%</discount_type>
<discount_amount>90</discount_amount>
</discount>
<duration>20:03:00</duration>
</tso_market>