Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Moving components from one XSD schema to another Ctd
Moving components from one XSD schema to another Ctd [message #583669] Thu, 04 March 2004 13:08
Hayden Marchant is currently offline Hayden MarchantFriend
Messages: 90
Registered: July 2009
Member
Hi,

I need to merge one XSD schema into another XSD Schema. I wrote code to do
this that works in the case that 1 schema includes the other schema -
works fantastically using the help that you gave me on July 31 2003:

You suggested: You can only merge included schemas into a single schema
since imports imply a
different namespace and each different target namespace will require a
different schema document to be defined. If you want something to be
contained by a particular schema you would add it to the list returned by
xsdSchema.getContents(); adding it to a new container will remove it from
its
old container automatically.

However, I now have a problem when the first schema imports the second
schema. The problem is how Eclipse manages the namespace when an object is
moved from one schema to another. In my example, I have an element in
schema A, which is of type CT which is imported from schema B. When I add
the objects from the imported schema (B) to the main schema, the namespace
is lost - which is great since I want one big schema. However, the element
in A that references that complex type that was in B but is now in A
refers to it with the namespace prefix. I would have expected that the
dependency mechanism of Eclipse model would have updated the referring
element's reference before moving the complex type- this does not seem to
be happening.

In order to see what I mean try using the 2 xsds samples that come with
XML Spy - OrgChart.xsd and Address.xsd. OrgChart.xsd imports address.xsd
and when I do orgChart.getContents().add(addressComplexType). When I try
to parse this new merged schema after saving the merged to disk, I get the
following error:

XSD: Type reference 'http://www.altova.com/IPO#US-Address' is unresolved.

Here is a snippet of my merged schema:

<xsd:complexType name="OfficeType">
<xsd:sequence>
<xsd:element ref="Name"/>
<xsd:element ref="Desc"/>
<xsd:element name="Address" type="ipo:US-Address"/>
<xsd:element name="Phone" type="xsd:string"/>
<xsd:element name="Fax" type="xsd:string"/>


Note that the complex type US-Address is no longer in namespace ipo but
the element reference thinks that it is.

Thanks,
Hayden Marchant
Previous Topic:Getting elements
Next Topic:Any tools for reducing a schema?
Goto Forum:
  


Current Time: Sat Oct 31 03:48:10 GMT 2020

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

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

Back to the top