- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Wed, 1 May 2002 10:36:59 +0100
- To: "Dent, Andrew" <aed5@cdc.gov>
- CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Hi Andrew, > I am new to XML and am in the process of creating a schema which > extends an existing schema. I have created the schema and developed > xml code that validates properly in XMLSpy. However, when validating > in MSXML, I receive this error: > > Element content is invalid according to DTD/schema, expecting > buildOption. > > Additionally, the line from the XML file that supplies this data > (ex: <buildOption>configure</buildOption>) is the line that MSXML > breaks on. People are always getting caught out on this... In your instance document, the buildOption element hasn't got a prefix, so it's in the default namespace for the instance document -- http://gis.cdc.gov. Your schema has that namespace as its target namespace *but* in XML Schema, when you declare an element locally (nested within a complex type or model group definition), then by default it's in *no* namespace. In your schema, the buildOption element is declared locally, so by default it's placed in no namespace. You can change the default for the schema by adding an elementFormDefault attribute to the xs:schema element, with a value of 'qualified': <schema targetNamespace="http://gis.cdc.gov" xmlns:gml="http://www.opengis.net/gml" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:gth="http://gis.cdc.gov" elementFormDefault="qualified"> ... </schema> Or you can tell the validator that the buildOption element is in the target namespace for the schema by adding a form attribute to its element declaration, again with a value of 'qualified': <complexType name="ViewType"> <complexContent> <extension base="gml:AbstractFeatureType"> <sequence> <element name="buildOption" type="string" form="qualified" /> </sequence> </extension> </complexContent> </complexType> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Wednesday, 1 May 2002 05:37:01 UTC