Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Creating new xml schema file example ?
Creating new xml schema file example ? [message #986] Tue, 24 September 2002 15:15 Go to next message
Eclipse UserFriend
Originally posted by: v.nisevic.mobilkom.at

Could you please show, how to create a simple xml schema file, with this
framework, including writing it to the file system. I cannot find enough
information classes org.eclipse.xsd.util

Thanks !

E.g.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="character" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="friend-of" type="xs:string" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="since" type="xs:date"/>
<xs:element name="qualification" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="isbn" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
Re: Creating new xml schema file example ? [message #1015 is a reply to message #986] Wed, 25 September 2002 18:39 Go to previous messageGo to next message
Shane Curcuru is currently offline Shane CurcuruFriend
Messages: 30
Registered: July 2009
Member
Example code showing the fundamentals of creating a schema and saving it are indeed in the org.eclipse.xsd.util package - have
you looked through the Javadoc for XSDPrototypicalSchema yet? In particular see:

savePurchaseOrderSchema(...) for a way to save an XSDSchema object to a URI by asking the ResourceSet framework to save it for
you;

printSchema(...)/printComponent(...) for a way to save an XSDSchema object by getting it's underlying concrete DOM object and
asking Xerces to directly serialize it for you;

the various initialize...() methods, that show how to build some sample schemas bit-by-bit.

Also, see the XSDSchemaBuildingTools.java for a set of very simplistic convenience methods that allow you to create basic
elements, attrs, etc, using single method calls to this wrapper instead of multiple calls to the library directly. Note that
while some of these methods have limited namespace support, they do show the kind of way that a simpler API for building
schemas could be built on top of the rich detail that the org.eclipse.xsd package provides.

- Shane
Re: Creating new xml schema file example ? [message #562481 is a reply to message #986] Wed, 25 September 2002 18:39 Go to previous messageGo to next message
Shane Curcuru is currently offline Shane CurcuruFriend
Messages: 30
Registered: July 2009
Member
Example code showing the fundamentals of creating a schema and saving it are indeed in the org.eclipse.xsd.util package - have
you looked through the Javadoc for XSDPrototypicalSchema yet? In particular see:

savePurchaseOrderSchema(...) for a way to save an XSDSchema object to a URI by asking the ResourceSet framework to save it for
you;

printSchema(...)/printComponent(...) for a way to save an XSDSchema object by getting it's underlying concrete DOM object and
asking Xerces to directly serialize it for you;

the various initialize...() methods, that show how to build some sample schemas bit-by-bit.

Also, see the XSDSchemaBuildingTools.java for a set of very simplistic convenience methods that allow you to create basic
elements, attrs, etc, using single method calls to this wrapper instead of multiple calls to the library directly. Note that
while some of these methods have limited namespace support, they do show the kind of way that a simpler API for building
schemas could be built on top of the rich detail that the org.eclipse.xsd package provides.

- Shane
Re: In AGR While Creating Datapool, "Link to Datapool" is not visible [message #1788209] Wed, 30 May 2018 16:17 Go to previous message
Eclipse UserFriend
1
Previous Topic:set annotation to schema object
Next Topic:The {max occurs} of an element in an 'all' model group must be 0 or 1
Goto Forum:
  


Current Time: Thu Nov 21 12:20:20 GMT 2024

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

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

Back to the top