Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » write out part of the loaded schema
write out part of the loaded schema [message #71612] Tue, 20 February 2007 19:57 Go to next message
Eclipse UserFriend
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 20:23 Go to previous message
Eclipse UserFriend
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 20:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
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?
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
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: Tue Apr 23 14:17:05 GMT 2024

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

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

Back to the top