Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » XMI Schema Generation
XMI Schema Generation [message #567821] Fri, 11 April 2003 17:54
Maneesh is currently offline ManeeshFriend
Messages: 5
Registered: July 2009
Junior Member
Hello,

I have few questions regarding XMI Schema Generation, based on Schema for
Example Library Model,

<xsd:complexType name="Writer">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element name="name" nillable="true" type="xsd:string"/>
<xsd:element name="category" nillable="true"
type="org.eclipse.example.library:BookCategory"/>
<xsd:element name="books" type="org.eclipse.example.library:Book"/>
<xsd:element ref="xmi:Extension"/>
</xsd:choice>
<xsd:attribute ref="xmi:id"/>
<xsd:attributeGroup ref="xmi:ObjectAttribs"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="category"
type="org.eclipse.example.library:BookCategory"/>
<xsd:attribute name="books" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="Writer" type="org.eclipse.example.library:Writer"/>

<xsd:complexType name="Book">
<xsd:complexContent>
<xsd:extension base="org.eclipse.example.library:Literature">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element name="title" nillable="true"
type="xsd:string"/>
<xsd:element name="pages" nillable="true" type="xsd:int"/>
<xsd:element name="category" nillable="true"
type="org.eclipse.example.library:BookCategory"/>
<xsd:element name="author"
type="org.eclipse.example.library:Writer"/>
</xsd:choice>
<xsd:attribute name="title" type="xsd:string"/>
<xsd:attribute name="pages" type="xsd:int"/>
<xsd:attribute name="category"
type="org.eclipse.example.library:BookCategory"/>
<xsd:attribute name="author" type="xsd:string"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

Q1. Why the relationship 'books' from 'Writer to Book' was transformed to
String attribute <xsd:attribute name="books" type="xsd:string"/>?
Q2. Why the relationship "author" from Book to Writer transformed to String?
Q3. Does that mean that every ComplexType needs to be translatable to some
sort of String? or These attributes shouldn't be declared at all!

Looking at XMI 2.0 Specs I didn't find that an Attribute needs to be
declared, when the property is of type thats not standard XMI type. May be I
am missing some information. Following is something I found in XMI 2.0 Spec.

"For attributes whose types are string type and whose upper bound
multiplicity is 1, an XML attribute must also be declared in the XML element
corresponding to metamodel class "c", and the XML element must be put in the
content model of the XML element for class "c"; the declaration of "c"
appears as follows without multiplicity enforcement:"

"For multi-valued attributes, no XML attributes are declared; each value is
encoded as an XML element."

"If an attribute has enumerated values, an XML element and an XML attribute
is put in the complexType for the class "c"; their declaration is as
follows:
<xsd:element name="a" type="enumName"/>
<xsd:attribute name="a" type="enumName" use="optional"/>"

Thanks,
Maneesh
Previous Topic:Attributes in Schema
Next Topic:XMI Schema Generation
Goto Forum:
  


Current Time: Thu Apr 18 03:49:31 GMT 2024

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

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

Back to the top