- From: Nick K. Aghazarian <Ace@AceProgrammer.com>
- Date: Tue, 12 Sep 2000 11:41:43 -0700
- To: www-xml-schema-comments@w3.org
Hello,
I've been trying to define my XML data stream with Schema for some time
now, and I
keep running into roadblocks. I thought I'd worked around most of them,
and started
putting my schemas and instance docs through the validator to see how I
did (I probably
should have started there to begin with, but oh well...). Since I'm
using the W3
Validator and it's still alpha, what I'm encountering may just be bugs
in the validator,
but I'm not sure.
Thanks for any guidance,
Nick
Here's my situation: I have a document that I can process, although I
have some default
values that will have to be coded for if I don't get them from the
parser via the Schema.
The basic structure of the document is:
<XMLData>
<Service xsi:type="ExtendedType1">
<InputData>
<FieldName>FieldValue</FieldName>
<Field2Name>Field2Value</Field2Name>
</InputData>
</Service>
</XMLData>
<schema xmlns="http://www.w3.org/1999/XMLSchema"
xmlns:XD="http://www.company.com/Schemas/XMLData"
targetNamespace="http://www.company.com/Schemas/XMLData">
<complexType name="Service" content="elementOnly" >
</complexType>
<complexType name="T1">
<group ref="XD:T1Fields" />
</complexType>
<group name="T1Fields">
<all>
<element name="User" type="string" minOccurs="0" />
<element name="TxnDate" type="timeInstant" minOccurs="0" />
</all>
</group>
<complexType name="ExtendedServiceType1" base="XD:Service"
content="elementOnly" derivedBy="extension">
<all>
<element name="InputData" type="XD:ET1" minOccurs="0" />
<element name="OutputData" type="XD:ET1" minOccurs="0"
maxOccurs="1" />
</all>
<attribute name="ServiceType" type="string" use="default"
value="ExtendedType1" />
</complexType>
<complexType name="ET1" base="XD:T1" derivedBy="extension">
<group ref="XD:ET1Fields" />
</complexType>
<group name="ET1Fields">
<all>
<element name="Object" type="string" minOccurs="0" />
<element name="Action" type="string" minOccurs="0" />
</all>
</group>
</schema>
I need to override the Service type with one derived from it. The
resulting type will have
an attribute (ServiceType) that has a default value. If I specify the
attribute on the
Service type, I can't seem to set or override its default value in the
derived type.
The result type will have derived types for each element. I can't seem
to get this to work
either. If I leave the elements out of the Service type declaration (as
I have above), I get
the following errors when trying to validate (if this is a bug in the
validator, that's OK, I
just need to know). I don't understand what the errors are telling me,
so I'm having a bit of
trouble adjusting the schema to be valid.
Schema representation errors
Detected during instance validation
http://www.aceprogrammer.com/XMLData/XMLExtendedServiceType1.xsd:6:1:
Invalid: non-deterministic content model for type
ExtendedServiceType1: {Wildcard: ##any}/{None}:InputData
Problems with the schema-validity of the target
http://www.aceprogrammer.com/XMLData/XMLData.xml:5:2:
Warning: using xsi:type
{http://www.company.com/Schemas/XMLData}:ExtendedServiceType1
http://www.aceprogrammer.com/XMLData/XMLData.xml:6:3:
Warning: allowing {http://www.company.com/Schemas/XMLData}:InputData
because
it matched wildcard(##any)
::: Warning: validating it laxly
Received on Tuesday, 12 September 2000 14:40:21 UTC