[oXygen-user] XSD Validation Error

George Cristian Bina
Thu Dec 1 07:05:34 CST 2005


Dear Helder,

I think this is an error in the spec. If you read a few lines above that 
you will see that if no namespace attribute is specified then the 
imported schema is for no namespace components:
***
If that attribute is absent, then the import allows unqualified 
reference to components with no target namespace.
***
So clearly there should not be a targetNamespace attribute present in 
that schema, because having such an attribute will place the components 
defined in that schema in that namespace.

Oxygen uses Xerces-J 2.7.1 for XML Schema validation. If you test also 
with other schema processors you will see that they report this error, I 
tried Schema Quality Checker, MSXML.NET and MSXML 4.0, Saxon SA and XSV 
and they all complain about this.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Helder Rossa wrote:
> Hi,
> 
> I Will investigate the second error like you say. but in XML Spy no 
> error is reported.
> 
> The first one I think is an error because the targetNamespace in the 
> imported file, and like the error says, has a targetNamespace 
> 'uri:namespace' so no 'namespace' attribute needs to be included in the 
> import directive.
> 
> Here is the RIGHT specification in the W3C:
> 
>     1 The appropriate *case* among the following must be true: 
> 
>     1.1 *If *the namespace [attribute]
>     <http://www.w3.org/TR/xml-infoset/#infoitem.element> is present,
>     *then *its · <http://www.w3.org/TR/xmlschema-1/#key-vv>actual value
>     <http://www.w3.org/TR/xmlschema-1/#key-vv>     <http://www.w3.org/TR/xmlschema-1/#key-vv> must not match the ·
>     <http://www.w3.org/TR/xmlschema-1/#key-vv>actual value
>     <http://www.w3.org/TR/xmlschema-1/#key-vv>     <http://www.w3.org/TR/xmlschema-1/#key-vv> of the enclosing <schema>
>     <http://www.w3.org/TR/xmlschema-1/#element-schema>'s targetNamespace
>     [attribute] <http://www.w3.org/TR/xml-infoset/#infoitem.element>. 
> 
>     1.2 *If *the namespace [attribute]
>     <http://www.w3.org/TR/xml-infoset/#infoitem.element> is not present,
>     *then *the enclosing <schema>
>     <http://www.w3.org/TR/xmlschema-1/#element-schema> must have a
>     targetNamespace [attribute]
>     <http://www.w3.org/TR/xml-infoset/#infoitem.element> 
> 
> 
> So, the namespace is NOT present in the <import> and I HAVE a 
> targetNamespace in the <import>ed schema.
> 
> 
> 
> On Wed, 2005-11-30 at 23:11 +0200, George Cristian Bina wrote:
>> Dear Helder Rossa,
>>
>> One of the nice features that you can find in oXygen is that it reports 
>> XML Schema errors in most cases not only with a descriptive message but 
>> also with a pointer to the XML Schema specification, pointing to the 
>> exact location related with that error.
>> In your case it poins you to
>> http://www.w3.org/TR/xmlschema-1/#src-import
>> The error code is src-import.3.2 which related with the pint 3.2 from 
>> the above URL:
>> ***
>> 3 The appropriate case among the following must be true:
>> 3.1 If there is a namespace [attribute], then its ·actual value· must be 
>> identical to the ·actual value· of the targetNamespace [attribute] of SII.
>> 3.2 If there is no namespace [attribute], then SII must have no 
>> targetNamespace [attribute]
>> ***
>> So as you can see, if no namespace attribute is specified then the 
>> imported schema must have no targetNamespace and this is not true in 
>> your case.
>>
>> Your email does not describes the exact details of the second error but 
>> I think that you want to say that oXygen does not allow the use 
>> attribute in a global attribute declaration but allows this in an 
>> attribute inside a complex type for instance. The oXygen behavior is 
>> correct and the explanation is that in one case we have an attribute 
>> declaration that can be used differently from different places and in 
>> the other case an attribute use. The error code s4s-att-not-allowed 
>> means that this is not allowed by the schema for schemas (s4s). And if 
>> you look into the schema for schemas you can see that the attribute 
>> element is of type topLevelAttribute that restricts the attribute type 
>> making the use of the "use" attribute prohibited.
>>
>>      <xs:element id="attribute" name="attribute" 
>> type="xs:topLevelAttribute">
>>      </xs:element>
>>
>>      <xs:complexType name="topLevelAttribute">
>>          <xs:complexContent>
>>              <xs:restriction base="xs:attribute">
>>                  <xs:sequence>
>>                      <xs:element minOccurs="0" ref="xs:annotation"/>
>>                      <xs:element minOccurs="0" name="simpleType" 
>> type="xs:localSimpleType">
>>                      </xs:element>
>>                  </xs:sequence>
>>                  <xs:attribute name="ref" use="prohibited"/>
>>                  <xs:attribute name="form" use="prohibited"/>
>>                  <xs:attribute name="use" use="prohibited"/>
>> ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^
>>
>>                  <xs:attribute name="name" type="xs:NCName" use="required">
>>                  </xs:attribute>
>>                  <xs:anyAttribute namespace="##other" 
>> processContents="lax"/>
>>              </xs:restriction>
>>          </xs:complexContent>
>>      </xs:complexType>
>>
>> Hope things are clear now.
>>
>> Best Regards,
>> George
>>
>>
>> Helder Rossa wrote:
>> > Hi,
>> > 
>> >  
>> > 
>> > I’ve got several errors validating a correct xsd file in oXygen Eclipse 
>> > Plug-In.
>> > 
>> >  
>> > 
>> >  
>> > 
>> > *Importing a XSD File*
>> > 
>> >  
>> > 
>> > Error:
>> > 
>> > src-import.3.2: An <import> element information item that had no 
>> > namespace attribute was found, so the imported document cannot have a 
>> > targetNamespace attribute. However, the targetNamespace 'uri:namespace' 
>> > was found in the imported document.
>> > 
>> > @see: http://www.w3.org/TR/xmlschema-1/#src-import
>> > 
>> >  
>> > 
>> > Occurs when:
>> > 
>> > <xs:import schemaLocation="anotherfile.xsd" />
>> > 
>> >  
>> > 
>> > Only works when:
>> > 
>> > <xs:import namespace=”uri:namespace” schemaLocation="anotherfile.xsd" />
>> > 
>> >  
>> > 
>> > This is incorrect!!
>> > 
>> >  
>> > 
>> >  
>> > 
>> > *Use Attribute in a Element*
>> > 
>> >  
>> > 
>> > Error:
>> > 
>> > s4s-att-not-allowed: Attribute 'use' cannot appear in element 'attribute'.
>> > 
>> >  
>> > 
>> > Occurs when:
>> > 
>> > <xs:attribute name="type" type="xs:string" use="required" />
>> > 
>> >  
>> > 
>> > Only Works when:
>> > 
>> > <xs:attribute name="type" type="xs:string" use="required" />
>> > 
>> >  
>> > 
>> >  
>> > 
>> > This is incorrect because use attribute is OK.
>> > 
>> >  
>> > 
>> >  
>> > 
>> >  
>> > 
>> > What I have to configure for oXygen work corrrectly?!
>> > 
>> >  
>> > 
>> >  
>> > 
>> > Thanx
>> > 
>> >  
>> > 
>> >  
>> > 
>> >  
>> > 
>> >  
>> > 
>> > 
>> > ------------------------------------------------------------------------
>> > 
>> > _______________________________________________
>> > oXygen-user mailing list
>> >  <mailto:>
>> > http://www.oxygenxml.com/mailman/listinfo/oxygen-user



More information about the oXygen-user mailing list