Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Creating Link in XSD
Creating Link in XSD [message #602939] Mon, 07 April 2008 14:18
Eclipse UserFriend
Originally posted by: Nicolas.Dufault.techsolcom.ca

Hi,

I'm currently writing an XSD file in order to input it in the reflective
GMF tool...

So basically I want to write my XSD and from it automaticaly generate my
diagram and the editor for it.

I'm pretty sure to do it the right way but all links between classes don't
show up. Only the aggregation between my VueTop and the two others are
working but between the class "Middle" and "Small" nothing works.

I use the mindmap.xsd as example, which works fine.

Maybe you could help me.

Titan.xsd is the name of my file.
Here's my file.

********************************
********** TITAN.XSD ***********

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace="/reflective.Xsd/model/XsdClassic/titan"
xmlns:titan="/reflective.Xsd/model/XsdClassic/titan"
ecore:nsPrefix="titan" ecore:package="titan"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">

<xsd:element name="vueTop" type="titan:VueTop"/>

<xsd:complexType ecore:instanceClass="com.reflective.ecore2Xsd.VueTop"
name="VueTop">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="middlez"
type="titan:Middle"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="smallz"
type="titan:Small"/>
<xsd:element name="title" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType ecore:instanceClass="com.reflective.ecore2Xsd.Middle"
name="Middle">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="email" type="xsd:string"/>
<xsd:element ecore:opposite="middles"
ecore:reference="titan:Small" name="smalls" type="xsd:anyURI"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType ecore:instanceClass="com.reflective.ecore2Xsd.Small"
name="Small">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="address" type="xsd:string"/>
<xsd:element ecore:opposite="smalls"
ecore:reference="titan:Middle" name="middles" type="xsd:anyURI"/>
</xsd:sequence>
</xsd:complexType>

</xsd:schema>

******************************

Here is a part of the mindmap.xsd example:
I remove some classes to make it shorter.


********************************
********* MINDMAP.XSD **********

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace="http://www.example.org/mindmap"
xmlns:mindmap="http://www.example.org/mindmap"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">

<xsd:element name="map" type="mindmap:Map"/>

<xsd:complexType name="Map">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="rootTopics"
type="mindmap:Topic"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="relations"
type="mindmap:Relationship"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="resources"
type="mindmap:Resource"/>
</xsd:sequence>
<xsd:attribute name="title" type="xsd:string"/>
</xsd:complexType>

<xsd:complexType name="Topic">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="comments"
type="mindmap:Thread"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute ecore:reference="mindmap:Topic" name="subtopics">
<xsd:simpleType>
<xsd:list itemType="xsd:anyURI"/>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute ecore:opposite="topics"
ecore:reference="mindmap:Resource" name="resources">
<xsd:simpleType>
<xsd:list itemType="xsd:anyURI"/>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="percentComplete" type="xsd:float"/>
<xsd:attribute name="priority" type="mindmap:Priority"/>
<xsd:attribute name="startDate" type="xsd:date"/>
<xsd:attribute name="endDate" type="xsd:date"/>
<xsd:attribute default="0" name="duration" type="xsd:float"/>
</xsd:complexType>

<xsd:complexType name="Resource">
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute ecore:opposite="resources"
ecore:reference="mindmap:Topic" name="topics">
<xsd:simpleType>
<xsd:list itemType="xsd:anyURI"/>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="email" type="xsd:string"/>
<xsd:attribute ecore:opposite="author"
ecore:reference="mindmap:Thread" name="comments">
<xsd:simpleType>
<xsd:list itemType="xsd:anyURI"/>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>

</xsd:schema>

*****************************************************

Thanks for your help !

Nicolas
Previous Topic:how to validate ExtendedMetaData details
Next Topic:Creating Link in XSD
Goto Forum:
  


Current Time: Thu Apr 25 15:48:26 GMT 2024

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

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

Back to the top