Error in eml parsing with new version of xmlspy and oXygen
Saurabh Garg
sgarg at nceas.ucsb.edu
Fri Mar 18 14:20:45 PST 2005
Hello,
Johnoel from Hawaii also reported the same problem which Margaret
reported earlier while using latest version of XMLSpy2005 or oXygen to
parse XML Schema
The error from oXygen is:
E cos-nonambig: "":describes and WC[##any] (or elements from their
substitution group) violate "Unique Particle Attribution". During
validation against this schema, ambiguity would be created for those two
particles. eml.xsd 246:27
More information about this can be found here:
http://www.w3.org/TR/2000/WD-xmlschema-1-20000407/#non-ambig
Following text from the above page descibes what is happening:
We say that two non-group particles *overlap* if
* One is a wildcard and the other an element declaration, and the
{target namespace}
<http://www.w3.org/TR/2000/WD-xmlschema-1-20000407/#e-target_namespace>
of the element declaration, or of any member of its equivalence
class <http://www.w3.org/TR/2000/WD-xmlschema-1-20000407/#key-eq>,
is schema-valid with respect to the {namespace constraint}
<http://www.w3.org/TR/2000/WD-xmlschema-1-20000407/#namespace_constraint>
of the wildcard.
So the schema that we have in EML is:
<xs:complexType>
<xs:sequence>
<xs:element name="describes" type="xs:string"
minOccurs="0" maxOccurs="unbounded">
</xs:element>
<xs:any processContents="lax">
</xs:any>
</xs:sequence>
<xs:attribute name="describes" type="xs:string" use="optional"/>
<xs:attribute name="id" type="res:IDType" use="optional"/>
</xs:complexType>
This is a problem because <xs:any> is a wildcard and could be anything
including <describes> itself. In particular a document which has
following text can confuse the parser
<additionalMetadata>
<describes>1</describes>
<describes>2</describes>
<describes>3</describes>
</additionalMetadata>
So here the parser doesnt know if the last <describes> tag should be
considered as <xs:any> or not.
(Though I think that as only one <xs:any> is possible, the last tag
should be takes as <xs:any> by default. But I must be missing something
as both oXygen and XMLSpy complain about this)
I was able to correct this error by doing the following
1. <describes> tag is required and can occur only once
<xs:complexType>
<xs:sequence>
<xs:element name="describes" type="xs:string">
</xs:element>
<xs:any processContents="lax">
</xs:any>
</xs:sequence>
<xs:attribute name="id" type="res:IDType" use="optional"/>
</xs:complexType>
2. describes is an attribute of additionalMetadata
<xs:complexType>
<xs:sequence>
<xs:any processContents="lax">
</xs:any>
</xs:sequence>
<xs:attribute name="describes" type="xs:string" use="optional"/>
<xs:attribute name="id" type="res:IDType" use="optional"/>
</xs:complexType>
3. <xs:any> is inside the <describes> tag
<xs:complexType>
<xs:sequence>
<xs:element name="describes" type="xs:string"
minOccurs="0" maxOccurs="1">
<xs:sequence>
<xs:any processContents="lax">
</xs:any>
</xs:sequence>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="res:IDType" use="optional"/>
</xs:complexType>
I think the first one would be the best in terms of minimum change to
the schema.
-Sid
Saurabh Garg wrote:
>
> Hello all,
>
> The attached file parses fine in the version of XmlSpy that I have
> (Version5 release 4). But when Margaret tries to parse it in the
> newest version of XMLSpy, she get the below given error:
>
> "Error in eml.xsd"
>
> When you open up eml.xsd, XMLSpy says this:
>
> "This file is not valid: <xs:element name='describes'> would make the
> content model non-deterministic."
>
> She tried opening the file in oXygen but that also gave an error. She
> wrote to oXgyen support to find out if something was wrong with oXygen
> and their support team sent her an email explaining soemthing is wrong
> with the EML schema. I am forwarding that email as an attachment.
>
> Is this because of a new version of Xerces is being used which is more
> strict in enforcing schema restrictions?
>
> Thanks
> Sid
>
More information about the Eml-dev
mailing list