Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » write out part of the loaded schema
write out part of the loaded schema [message #71612] Tue, 20 February 2007 14:57 Go to next message
Eclipse User
Originally posted by: Atish.Das.ugs.com

I am using XML Schema Infoset to load a "myschema.xsd". Once it is loaded I
would like to create sub xsd files that contain a sub set of the elements
loaded from "myschema.xsd". The subsets that I want to write out may have
dependent complex types which should also needs to be written out.
For example. Here is my xsd-
<xsd:complexType name="MyType">

<xsd:complexContent>

<xsd:extension base="xyz:MyBaseType">

<xsd:attribute name="arch_type" type="xsd:string" />

<xsd:attribute name="arch_elem_id" type="xsd:string" />

</xsd:extension>

</xsd:complexContent>

</xsd:complexType>

<xsd:element name="MyElement" type="xyz:MyType" />

<xsd:complexType name="MyBaseType">

</xsd:complexType>

XSDSchema schema = loadSchema("myschema.xsd")
Resource mysubset = resourceSet.createResource("mysubset.xml")
XSDElementDeclaration element= (XSDElementDeclaration )
schema.getElement...("MyElement");
mysubset.getcontents().add(element)
resource.save(null)

Here when I save "MyElement" I would like to have all its depndents
"MyBaseType" and "MyType" also saved.
The only way I can do this, is I resolve these dependencies and add them to
the resource and save it.

Is there a convenient way in Schema Infoset to save a subset of the loaded
schema?
Re: write out part of the loaded schema [message #71631 is a reply to message #71612] Tue, 20 February 2007 15:23 Go to previous message
Eclipse User
Originally posted by: merks.ca.ibm.com

Atish,

There are no built-in utilities to do this.


Atish Das wrote:
> I am using XML Schema Infoset to load a "myschema.xsd". Once it is loaded I
> would like to create sub xsd files that contain a sub set of the elements
> loaded from "myschema.xsd". The subsets that I want to write out may have
> dependent complex types which should also needs to be written out.
> For example. Here is my xsd-
> <xsd:complexType name="MyType">
>
> <xsd:complexContent>
>
> <xsd:extension base="xyz:MyBaseType">
>
> <xsd:attribute name="arch_type" type="xsd:string" />
>
> <xsd:attribute name="arch_elem_id" type="xsd:string" />
>
> </xsd:extension>
>
> </xsd:complexContent>
>
> </xsd:complexType>
>
> <xsd:element name="MyElement" type="xyz:MyType" />
>
> <xsd:complexType name="MyBaseType">
>
> </xsd:complexType>
>
> XSDSchema schema = loadSchema("myschema.xsd")
> Resource mysubset = resourceSet.createResource("mysubset.xml")
> XSDElementDeclaration element= (XSDElementDeclaration )
> schema.getElement...("MyElement");
> mysubset.getcontents().add(element)
> resource.save(null)
>
> Here when I save "MyElement" I would like to have all its depndents
> "MyBaseType" and "MyType" also saved.
> The only way I can do this, is I resolve these dependencies and add them to
> the resource and save it.
>
> Is there a convenient way in Schema Infoset to save a subset of the loaded
> schema?
>
>
>
Re: write out part of the loaded schema [message #602137 is a reply to message #71612] Tue, 20 February 2007 15:23 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25999
Registered: July 2009
Senior Member
Atish,

There are no built-in utilities to do this.


Atish Das wrote:
> I am using XML Schema Infoset to load a "myschema.xsd". Once it is loaded I
> would like to create sub xsd files that contain a sub set of the elements
> loaded from "myschema.xsd". The subsets that I want to write out may have
> dependent complex types which should also needs to be written out.
> For example. Here is my xsd-
> <xsd:complexType name="MyType">
>
> <xsd:complexContent>
>
> <xsd:extension base="xyz:MyBaseType">
>
> <xsd:attribute name="arch_type" type="xsd:string" />
>
> <xsd:attribute name="arch_elem_id" type="xsd:string" />
>
> </xsd:extension>
>
> </xsd:complexContent>
>
> </xsd:complexType>
>
> <xsd:element name="MyElement" type="xyz:MyType" />
>
> <xsd:complexType name="MyBaseType">
>
> </xsd:complexType>
>
> XSDSchema schema = loadSchema("myschema.xsd")
> Resource mysubset = resourceSet.createResource("mysubset.xml")
> XSDElementDeclaration element= (XSDElementDeclaration )
> schema.getElement...("MyElement");
> mysubset.getcontents().add(element)
> resource.save(null)
>
> Here when I save "MyElement" I would like to have all its depndents
> "MyBaseType" and "MyType" also saved.
> The only way I can do this, is I resolve these dependencies and add them to
> the resource and save it.
>
> Is there a convenient way in Schema Infoset to save a subset of the loaded
> schema?
>
>
>
Previous Topic:write out part of the loaded schema
Next Topic:an issue when using the xml schema editor to show the reference element...
Goto Forum:
  


Current Time: Fri Aug 22 06:02:45 EDT 2014

Powered by FUDForum. Page generated in 0.01881 seconds