- From: Elena Litani <hlitani@jtcsv.com>
- Date: Tue, 05 Dec 2000 15:58:23 -0500
- To: Michael Burns <Michael.Burns@sas.com>, xmlschema-dev@w3.org
Hi, Michael, I am still relatively new to schema but I will give it a try. In your schema you have 'elementFormDefault = "unqualified", which means that all your elements don't have namespace assigned to them, thus qualified name is "null:element" However, in your instance document you say: xmlns="http://www.sas.com/Critters" which assigns to all elements in your document the namespace, and qualified name becomes = "uri:element" Thus any parser will complain -> it would assume uri:element is declared somewhere, but instead your grammar was built using qualified name = "null:element". To fix this problem you can do 2 things: 1) change in your schema : elementFormDefault = "qualified" OR 2) in your instance document : <foo:Vertebrate xmlns:foo="http://www.sas.com/Critters" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:schemaLocation="http://www.sas.com/Critters Vertebrate.xsd" Name="MarshHawk" LimbType="wing"> <PreyList> <Vertebrate Name="Mickey"/> </PreyList> </foo:Vertebrate> Hope it helps, -- Elena Litani * IBM Canada - Toronto* Michael Burns wrote: > I am still struggling with a schema I generated from a UML model.I > have posted this before and gotten some help with it but have not made > significant progress.Thinking I was using the spec elements in ways > they were not intended, I have rewrittenthe schema from scratch using > XML Authority to see how it chooses to code the schema.XMLAuthority v2 > validates this schema as OK, so does XMLSpy v3.5. I am trying to > imlement UML type one to many associations with elements thatcan be > subclassed. Frustrated at the progress I made with even a fairly > simplemodel, I have reduced it to an extremely simple model: one class > (Vertebrate)that can prey on a list of other Vertebrates via an > association called PreyList.Here is the schema (Vertebrate.xsd):<?xml > version = "1.0" encoding = "UTF-8"?> > <!--Generated by XML Authority. Conforms to w3c > http://www.w3.org/2000/10/XMLSchema--> > <xsd:schema xmlns:critters = "http://www.sas.com/Critters" > targetNamespace = "http://www.sas.com/Critters" > xmlns:xsd = "http://www.w3.org/2000/10/XMLSchema" > > version = "" > elementFormDefault = "unqualified" > attributeFormDefault = "unqualified"> > <!-- edited with XML Spy v3.5 NT beta 2 build Dec 1 2000 > (http://www.xmlspy.com) by Michael Burns (SAS Institute, Inc.) --> > <xsd:complexType name = "VertebrateType"> > <xsd:sequence> > <xsd:element name = "PreyList" minOccurs = "0"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref = "critters:Vertebrate" minOccurs = "0" > maxOccurs = "unbounded"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > </xsd:sequence> > <xsd:attribute name = "Name" use = "required" type = > "xsd:Name"/> > <xsd:attribute name = "Bones" type = "xsd:boolean"/> > <xsd:attribute name = "NLimbs" type = "xsd:nonNegativeInteger"/> > <xsd:attribute name = "LimbType" use = "required"> > <xsd:simpleType> > <xsd:restriction base = "xsd:string"> > <xsd:enumeration value = "leg"/> > <xsd:enumeration value = "wing"/> > <xsd:enumeration value = "fin"/> > <xsd:enumeration value = "none"/> > <xsd:enumeration value = "mixed"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:attribute> > </xsd:complexType> > <xsd:element name = "Vertebrate" > > <xsd:complexType> > <xsd:complexContent> > <xsd:extension base = "critters:VertebrateType"> > <xsd:sequence/> > </xsd:extension> > </xsd:complexContent> > </xsd:complexType> > </xsd:element> > </xsd:schema> Here is the very simple instance > (VertPreysOnVert.xml):<?xml version="1.0" encoding="UTF-8"?> > <!-- edited with XML Spy v3.5 NT beta 2 build Dec 1 2000 > (http://www.xmlspy.com) by Michael Burns (SAS Institute, Inc.) --> > <Vertebrate > xmlns="http://www.sas.com/Critters" > xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" > xsi:schemaLocation="http://www.sas.com/Critters Vertebrate.xsd" > Name="MarshHawk" LimbType="wing"> > <PreyList> > <Vertebrate Name="Mickey"/> > </PreyList> > </Vertebrate> Like I said, XMLSpy and XMLAuthority both validate the > schema fine.However, XMLSpy, XSV and Oracle's schema validating parser > all agreethat <PreyList> does not belong as a contained element inside > <Vertebrate>.XSV says: - - - - - - - - - - - - > > Problems with the schema-validity of the target > > file:/C:/ModelCompilerTestPen/test/critt > rs/XMLauthority/VertPreysOnVert.xml:4:2: Invalid per > cvc-complex-type.1.2.4: element {http://www.sas.com/Critters}:PreyList > not allowed here in element {http://www.sas.com/Critters}:Vertebrate: > > > ile:/C:/ModelCompilerTestPen/test/critters/XMLauthority/VertPreysOnVert.xml:4:2: Invalid > per src-resolve: undeclared element > {http://www.sas.com/Critters}:PreyList > - - - - - - - - - - - - Oracle validator says: - - - - - - - - - - - > - --------------------------------------------------------------------------------------------Michael > Burns email: Michael.Burns@sas.com > Principal Systems Developer home: mburns@bga.com > Metadata Integration Technology voice: (512)258-5171x3264 > SAS Institute, Inc. fax: (512)258-3906 > 11920 Wilson Parke Ave. www: http://www.realtime.net/~mburns > Austin, TX 78726-4052 sww: http://sww.sas.com/~sasmkb > "choose for yourselves today whom you will serve;... > but as for me and my house, we will serve the Lord." Joshua 24:15 >
Received on Tuesday, 5 December 2000 15:58:06 UTC