Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Problems with <redefine>
Problems with <redefine> [message #594678] Thu, 07 April 2005 02:07
Eclipse User
Originally posted by: lgardner.tycoint.com

Hi all,

I'm trying to access a schema containing a <redefine> section and am
getting unexpected results.

I have a basic schema (test,xsd):

<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test.com" xmlns:sdk="http://test.com">
<element name="toplevel">
<annotation sdk:caption="TOP LEVEL"/>
<complexType>
<sequence>
<element ref="sdk:base" />
</sequence>
</complexType>
</element>
<complexType name="base-type">
<attribute name="attr1" type="string" />
</complexType>
<element name="base" type="sdk:base-type" />
</schema>

which I can use with the following instance document (test.xml):

<toplevel xmlns="http://test.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test.com file:c:/Temp/test.xsd">
<base attr1="Attribute 1"/>
</toplevel>

If I load and query the schema:

XSDResourceImpl xsdResource = (XSDResourceImpl)
resourceSet.getResource(uri, true);
XSDSchema schema = xsdResource.getSchema();
XSDAnnotation annotation =
schema.resolveElementDeclaration("http://test.com",
"toplevel").getAnnotation();

then my annotation contains (as expected) the 'sdk:caption' attribute.

I then perform exactly the same steps again but now using a redefined
schema (redefined.xsd):

<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test.com" xmlns:sdk="http://test.com">
<redefine schemaLocation="file:c:/temp/test.xsd">
<complexType name="base-type">
<complexContent>
<extension base="sdk:base-type">
<attribute name="added" type="string" />
</extension>
</complexContent>
</complexType>
</redefine>
</schema>

with the extended instance document (redefined.xml):

<toplevel xmlns="http://test.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test.com file:c:/Temp/redefined.xsd">
<base attr1="Attribute 1" added="Added"/>
</toplevel>

When I load and query the schema (exactly as before) the 'toplevel'
annotation element now has 0 attributes.

Have I stumbled over a bug or is this not the way redefines are supposed
to work?

Thanks in advance,
Lewis Gardner
Previous Topic:How to get the XSDAttributeUse from a DOM-Node?
Next Topic:Problems with <redefine>
Goto Forum:
  


Current Time: Wed Sep 17 01:34:19 GMT 2014

Powered by FUDForum. Page generated in 0.01470 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software