Re: Ques on how to validate xml against schema

One other thing...

Your anonymous type definition for the global element declaration 'locus'
should use xsd:extension rather than xsd:restriction as you are extending
xsd:string by adding attributes to it.

The XSV schema processor doesn't catch this error but the Oracle one does.

The Oracle processor also complains about the pattern facet on the
medlineType simple type. I'm not a regex expert but it seems to be
complaining about the content of the pattern facet ( the regex itself ). I
can't find in my regex book what \a means... except that it usually maps to
ASCII 7 ( Bell ). I looked in your instance but there is no underscore or
anything else after the 8 digit number...

Martin Gudgin
DevelopMentor

----- Original Message -----
From: "June Tan" <chen_wenli2000@yahoo.com>
To: <www-xml-schema-comments@w3.org>
Sent: Friday, December 22, 2000 4:19 AM
Subject: Ques on how to validate xml against schema


> i got an error msg in validating XML against schema.
> The error msg goes something like this 'root element
> MegaXML not defined in dtd/schema', but actually i've
> already define that. Isit the way i validate is wrong
> or what?
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/
>
>


----------------------------------------------------------------------------
----


> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
elementFormDefault="qualified"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2000/10/XMLSchema
http://www.w3.org/2000/10/XMLSchema.xsd">
> <xsd:element name="MegaXML">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="j:dna_db" minOccurs="0" maxOccurs="unbounded"/>
> <xsd:element ref="j:protein_db" minOccurs="0" maxOccurs="unbounded"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="dna_db">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="dna_entry" minOccurs="0" maxOccurs="unbounded">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="j:locus"/>
> <xsd:element ref="j:definition"/>
> <xsd:element ref="j:accession"/>
> <xsd:element ref="j:version"/>
> <xsd:element ref="j:keywords"/>
> <xsd:element ref="j:source" />
> <xsd:element ref="j:reference"/>
> <xsd:element ref="j:features"/>
> <xsd:element ref="j:origin"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="locus">
> <xsd:complexType>
> <xsd:simpleContent>
> <xsd:restriction base="xsd:string">
> <xsd:attribute name="bp" type="xsd:string"/>
> <xsd:attribute name="type" type="xsd:string"/>
> <xsd:attribute name="section" type="xsd:string"/>
> <xsd:attribute name="date" type="xsd:string"/>
> </xsd:restriction>
> </xsd:simpleContent>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="definition" type="xsd:string"/>
> <xsd:element name="accession" type="xsd:string"/>
> <xsd:element name="version" type="xsd:string"/>
> <xsd:element name="keywords" type="xsd:string"/>
> <xsd:element name="source">
> <xsd:complexType>
> <xsd:attribute name="name" type="xsd:string"/>
> <xsd:attribute name="organism" type="xsd:string"/>
> <xsd:attribute name="taxonomy" type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="reference">
> <xsd:complexType>
> <xsd:attribute name="ref" type="xsd:string"/>
> <xsd:attribute name="authors" type="xsd:string"/>
> <xsd:attribute name="title" type="xsd:string"/>
> <xsd:attribute name="journal" type="xsd:string"/>
> <xsd:attribute name="medline" type="j:medlineType"/>
> </xsd:complexType>
> </xsd:element>
> <xsd:simpleType name="medlineType">
>         <xsd:restriction base="xsd:string">
>             <xsd:pattern value="\d{8}_\a(3)"/>
>         </xsd:restriction>
>     </xsd:simpleType>
> <xsd:element name="features">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="feature" minOccurs="0" maxOccurs="unbounded">
> <xsd:complexType>
> <xsd:attribute name="type" type="xsd:string"/>
> <xsd:attribute name="location" type="xsd:string"/>
> <xsd:attribute name="organism" type="xsd:string"/>
> <xsd:attribute name="mitochondrion" type="xsd:string"/>
> <xsd:attribute name="sub_species" type="xsd:string"/>
> <xsd:attribute name="db_xref" type="xsd:string"/>
> <xsd:attribute name="dev_stage" type="xsd:string"/>
> <xsd:attribute name="tissue_type" type="xsd:string"/>
> <xsd:attribute name="codon_start" type="xsd:string"/>
> <xsd:attribute name="transl_table" type="xsd:string"/>
> <xsd:attribute name="product" type="xsd:string"/>
> <xsd:attribute name="protein_id" type="xsd:string"/>
> <xsd:attribute name="translation" type="xsd:string"/>
> <xsd:attribute name="strain" type="xsd:string"/>
> <xsd:attribute name="chromosome" type="xsd:string"/>
> <xsd:attribute name="map" type="xsd:string"/>
> <xsd:attribute name="notes" type="xsd:string"/>
> <xsd:attribute name="gene" type="xsd:string"/>
> <xsd:attribute name="EC_number" type="xsd:string"/>
> <xsd:attribute name="rpt_type" type="xsd:string"/>
> <xsd:attribute name="clone_lib" type="xsd:string"/>
> <xsd:attribute name="function" type="xsd:string"/>
> <xsd:attribute name="coded_by" type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="Seqdesc" type="xsd:string"/>
> <xsd:element name="origin"  type="xsd:string"/>
> <xsd:element name="protein_db">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="protein_entry" minOccurs="0" maxOccurs="unbounded">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="j:locus"/>
> <xsd:element ref="j:definition"/>
> <xsd:element ref="j:accession"/>
> <xsd:element ref="j:pid"/>
> <xsd:element ref="j:version"/>
> <xsd:element ref="j:dbsource"/>
> <xsd:element ref="j:keywords"/>
> <xsd:element ref="j:source"/>
> <xsd:element ref="j:reference"/>
> <xsd:element ref="j:Seqdesc"/>
> <xsd:element ref="j:features"/>
> <xsd:element ref="j:origin"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="pid" type="xsd:string"/>
> <xsd:element name="dbsource" type="xsd:string"/>
> <xsd:element name="sequence_length"/>
> <xsd:element name="div_code"/>
> <xsd:element name="OrgMod">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="OrgMod_subtype" type="xsd:string"/>
> <xsd:element name="OrgMod_subname" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="dna_base_count">
> <xsd:complexType>
> <xsd:attribute name="a" type="xsd:string"/>
> <xsd:attribute name="c" type="xsd:string"/>
> <xsd:attribute name="t" type="xsd:string"/>
> <xsd:attribute name="g" type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="pro_base_count">
> <xsd:complexType>
> <xsd:attribute name="g" type="xsd:string"/>
> <xsd:attribute name="w" type="xsd:string"/>
> <xsd:attribute name="a" type="xsd:string"/>
> <xsd:attribute name="v" type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>


----------------------------------------------------------------------------
----


> <?xml version="1.0"?>
> <MegaXML xmlns="http://localhost:8080"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:schemaLocation="http://localhost:8080 MegaSchema.xsd">
> <protein_db>
> <protein_entry>
> <locus bp="142 aa" type="CAA32850" section="MAM" date="30-MAR-1993"/>
> <definition>beta-C globin [Ovis aries].</definition>
> <accession>CAA32850</accession>
> <pid>g1213</pid>
> <version>CAA32850.1  GI:1213</version>
> <dbsource>embl locus OABCGLOB, accession X14728.1</dbsource>
> <keywords>""</keywords>
> <source name="sheep" organism="Ovis aries Eukaryota; Metazoa; Chordata;
Vertebrata; Mammalia; Eutheria;Artiodactyla; Ruminantia; Pecora;
Bovoidea;Bovidae; Caprinae;Ovis."/>
> <reference ref="1  (residues 1 to 142)" authors="Garner,K.J. and
Lingrel,J.B." title="A comparison of the beta A-and beta B-globin gene
clusters of sheep" journal="J. Mol. Evol. 28 (3), 175-184 (1989)"
medline="89178744"/>
> <Seqdesc>equence correction was due to printing error in publication Data
>             kindly reviewed (09-JAN-1990) by Garner K.J.</Seqdesc>
> <features>
> <feature type="source" location="1..142" organism="Ovis aries"
db_xref="taxon:9940"/>
> <feature type="Protein" location="1..142" product="beta-C globin"/>
> <feature type="CDS" location="1..142" db_xref="SWISS-PROT:P02079"
coded_by="join(1212:880..956,1212:1089..1311,1212:2155..2283)"/>
> </features>
> <origin> mpnkalitgf wskvkvdevg aealgrllvv ypwtqrffeh fgdlstadav lgnakvkahg
>         kkvldsfsng vqhlddlkgt faqlselhcd klhvdpenfr llgnvlvvvl arhfgkeftp
>       1 elqaefqkvv agvasalahr yh</origin>
> </protein_entry>
> </protein_db>
> </MegaXML>
>

Received on Friday, 22 December 2000 00:02:44 UTC