How to model in XSD? [message #55279] |
Mon, 25 September 2006 11:44  |
Eclipse User |
|
|
|
Hey,
I'm having trouble with building a model for gmf in a xsd file.
I want to start off with a very simple model that contains only one type
of element that can then be associated with other elements (a directed
association) of the same type. The element will have some attributes (or
should these be elements?) as well but it's doing the association I don't
understand.
What I want to model is a simple dialogue that is divided into segments.
Each node to be a segment in a graph structure.
Is there any documentation on this? Cheers.
So something like:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace="http://www.example.org/dialoguegraph"
xmlns:dialoguegraph="http://www.example.org/dialoguegraph"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
<xsd:complexType name="DialogueSegment">
<xsd:attribute name="intro_text" type="xsd:string"/> //set to max of one
<xsd:attribute name="transcript" type="xsd:string"/> //set to max of one
<xsd:attribute name="outro_text" type="xsd:string"/> //0..*
</xsd:complexType>
//set the relatonship between nodes?????
</xsd:schema>
|
|
|
|
|
Re: How to model in XSD? [message #55735 is a reply to message #55706] |
Tue, 26 September 2006 08:07  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------000605080806030505000705
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Gaff,
I can't really answer questions about how you should model something
(since I don't really know what goal you are trying to achieve and don't
have the time). Typically its a good idea to define a global element for
anything you wish to serialize at the root of a document. If you
already know the model you want, but don't know how to write it as a
schema, you might want to try creating the Ecore model directly,
creating a GenModel for it, and then exporting the corresponding
schema. This demo might help:
http://adobedev.breezecentral.com/p17835008/
You should try to ask more specific questions because open ended ones
that require a long story are much less likely to get the kind of
information you are looking for...
Gaff wrote:
> Cheers, the XML Schema to Ecore Mapping is good for the syntax but not
> sure it really explains what needs to be in the file. Like, do I need
> to have an abstract definition first that contains all other figures?
> Do I need to state which is the diagram root element in the xsd file?
>
> Is this kind of stuff explained anywhere?
>
> To start with i'm just trying to get a node worknig by itself, the xsd
> is below, I've tried getting an editor working with it and get as far
> as ECore to GMFGraph, Diagram root element, as all the code is
> generated from my model there must be something wrong with it:
>
> (BTW, thanks for your hwelp ED)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema 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:complexType name="DiaSeg">
> <xsd:sequence>
> <xsd:element maxOccurs="unbounded" minOccurs="0" name="intro"
> type="xsd:string"/>
> <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="transcript" type="xsd:string"/>
> <xsd:element maxOccurs="unbounded" minOccurs="0" name="outro"
> type="xsd:string"/>
> </xsd:sequence>
> <xsd:attribute name="alittlebit" type="xsd:string"/>
> </xsd:complexType>
> </xsd:schema>
>
--------------000605080806030505000705
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Gaff,<br>
<br>
I can't really answer questions about how you should model something
(since I don't really know what goal you are trying to achieve and
don't have the time). Typically its a good idea to define a global
element for anything you wish to serialize at the root of a document.
|
|
|
Powered by
FUDForum. Page generated in 0.06278 seconds