Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Problems with <redefine>
Problems with <redefine> [message #59031] Wed, 06 April 2005 22:07 Go to next message
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
Re: Problems with <redefine> [message #59057 is a reply to message #59031] Thu, 07 April 2005 07:17 Go to previous message
Eclipse User
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------000503080402080601000208
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Lewis,

This sounds like:

88092 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=88092>


Lewis Gardner wrote:

> 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
>
>
>
>


--------------000503080402080601000208
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Lewis,<br>
<br>
This sounds like:<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=88092">88092</a><br>
</blockquote>
<br>
Lewis Gardner wrote:
<blockquote cite="mid8b2713a91687217a5ccf43b6e41ef6ad$1@www.eclipse.org"
type="cite">Hi all,
<br>
<br>
I'm trying to access a schema containing a &lt;redefine&gt; section and
am getting unexpected results.
<br>
<br>
I have a basic schema (test,xsd):
<br>
<br>
&lt;schema xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
<br>
Re: Problems with <redefine> [message #594687 is a reply to message #59031] Thu, 07 April 2005 07:17 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26000
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000503080402080601000208
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Lewis,

This sounds like:

88092 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=88092>


Lewis Gardner wrote:

> 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
>
>
>
>


--------------000503080402080601000208
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Lewis,<br>
<br>
This sounds like:<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=88092">88092</a><br>
</blockquote>
<br>
Lewis Gardner wrote:
<blockquote cite="mid8b2713a91687217a5ccf43b6e41ef6ad$1@www.eclipse.org"
type="cite">Hi all,
<br>
<br>
I'm trying to access a schema containing a &lt;redefine&gt; section and
am getting unexpected results.
<br>
<br>
I have a basic schema (test,xsd):
<br>
<br>
&lt;schema xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
<br>
Previous Topic:Problems with <redefine>
Next Topic:Determining if an <include>'d schema has a defined target namespace
Goto Forum:
  


Current Time: Fri Aug 22 13:59:03 EDT 2014

Powered by FUDForum. Page generated in 0.07461 seconds