You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Eric J. Schwarzenbach" <er...@wrycan.com> on 2004/02/26 16:05:01 UTC

bug? redefinition and namespace coercion

Maybe I'm just being stupid, but I think I may be running into
a bug (Xerces 2.6.2) regarding redefining a type from a no
namespace schema into a namespaced schema. 

I get 2 contradictory errors validating an xml file using a
schema with this construct:

[Error] unittest.xml:2:154: cvc-complex-type.3.2.2: Attribute
'someAttr' is not allowed to appear in element 'test'.
[Error] unittest.xml:2:154: cvc-complex-type.4: Attribute
'someAttr' must appear on element 'test'.

I'm getting this by running it through dom.Counter or
sax.Counter from the xercesSamples.jar (with switches  -n -v
-s -f).

I have a base schema (redefTestBase.xsd) with no namespace
like this:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="test" type="testType"/>
	<xs:complexType name="testType" mixed="false">
		<xs:attribute ref="someAttr" use="required"/>
	</xs:complexType>
	<xs:simpleType name="someAttrType">
		<xs:restriction base="xs:token"/>
	</xs:simpleType>
	<xs:attribute name="someAttr" type="someAttrType"/>
</xs:schema>

then I have second schema (redefTestDerived.xsd) with a
namespace that redefines a type from the first schema (which I
expect to be coerced into the second schema's namespace)

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="redefTest"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:rdt="redefTest" elementFormDefault="qualified"
attributeFormDefault="unqualified">
	<xs:redefine schemaLocation="redefTestBase.xsd">
		<xs:simpleType name="someAttrType">
			<xs:restriction base="rdt:someAttrType">
				<xs:enumeration value="SOME VALUE"/>
			</xs:restriction>
		</xs:simpleType>
	</xs:redefine>
	<xs:element name="unitTest">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="rdt:test"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

The unitTest element is just to validate that the element has
been coerced.

Xerces validates both of these xsds but attempting to validate
an xml instance of the second schema fails. 

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="redefTest"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="redefTest redefTestDerived.xsd"
someAttr="SOME VALUE"/>

My impression is something weird may be going on relating to
the order in which the parser is applying the coercions and
the redefinition.

Can someone verify whether this is a bug or if I am missing
something?

Thanks,

Eric

--
Eric J. Schwarzenbach
Principal Content Architect / Wrycan, Inc.
617.684.0182

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: bug? redefinition and namespace coercion

Posted by "Eric J. Schwarzenbach" <Er...@wrycan.com>.
That seems to be exactly what I was seeing. And it looks like 
nonnamespace->namespace coercion and type redefinition is really working 
properly--I had forgotten that global attribute definitions unlike local 
ones required qualification under attributeFormDefault="unqualified".

Thanks,

Eric



George Cristian Bina wrote:

>>I get 2 contradictory errors validating an xml file using a
>>schema with this construct:
>>
>>[Error] unittest.xml:2:154: cvc-complex-type.3.2.2: Attribute
>>'someAttr' is not allowed to appear in element 'test'.
>>[Error] unittest.xml:2:154: cvc-complex-type.4: Attribute
>>'someAttr' must appear on element 'test'.
>>    
>>
>
>See:
>
>Contradictory validation messages
>http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24292
>
>I have not checked your report in detail but I guess it is the same problem.
>
>Best Regards,
> George
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: bug? redefinition and namespace coercion

Posted by George Cristian Bina <ge...@sync.ro>.
> I get 2 contradictory errors validating an xml file using a
> schema with this construct:
>
> [Error] unittest.xml:2:154: cvc-complex-type.3.2.2: Attribute
> 'someAttr' is not allowed to appear in element 'test'.
> [Error] unittest.xml:2:154: cvc-complex-type.4: Attribute
> 'someAttr' must appear on element 'test'.

See:

Contradictory validation messages
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24292

I have not checked your report in detail but I guess it is the same problem.

Best Regards,
 George
-------------------------------------------------------------
George Cristian Bina mailto:george@oxygenxml.com
<oXygen/> XML Editor - http://www.oxygenxml.com/




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org