Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » XML Generation and element hiding
XML Generation and element hiding [message #67811] Fri, 21 April 2006 09:49 Go to next message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Hello,

I am looking for a way to simplify this bit of XML Schema. Namely, I
have an element which is not useful ("XXX"), but required ID-wise. The
purpose of this is to generate some XML.



<xsd:complexType name="listeningDataType" ecore:name="listeningData">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="unbounded" name="datas"
type="datasType"/>
</xsd:sequence>
<!-- Couple of attributes there -->
</xsd:complexType>

<xsd:complexType name="datasType" ecore:name="datas">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="dataId"
type="xsd:IDREF" ecore:reference="dataidtype"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="outputType" ecore:name="output">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="XXX"
type="dataidtype"/>
</xsd:sequence>
<!-- Couple of attributes there -->
</xsd:complexType>

<xsd:complexType name="dataidtype" ecore:name="dataId">
<xsd:sequence>
<xsd:element name="dataId" type="xsd:ID"/>
</xsd:sequence>
</xsd:complexType>

Using this schema, I end up with the following generated XML code (via
EMF):

<output [.. some attributes...]>
<XXX>
<dataId>myDataId</dataId>
</XXX>
</output>
<listeningdata [... some attributes ...]>
<datas>
<dataId>myDataId</dataId>
</datas>
</listeningdata>

As you can guess, I would like to get rid of the XML element "XXX", but
still would like to be able to include 'dataidtype' in 'output'.
Eventually, is there a way not to make it appear during the XML generation?
Any ideas?
Re: XML Generation and element hiding [message #67836 is a reply to message #67811] Fri, 21 April 2006 11:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Guillaume,

One suggestion. Data is plural for datum, so datas is kind of bad.

Since you can't have multiple IDs for a given element, I'd need to know
what goal you are trying to achieve by having what's effectively just a
list of IDs.


Guillaume Windels wrote:
> Hello,
>
> I am looking for a way to simplify this bit of XML Schema. Namely, I
> have an element which is not useful ("XXX"), but required ID-wise. The
> purpose of this is to generate some XML.
>
>
>
> <xsd:complexType name="listeningDataType" ecore:name="listeningData">
> <xsd:sequence>
> <xsd:element minOccurs="1" maxOccurs="unbounded" name="datas"
> type="datasType"/>
> </xsd:sequence>
> <!-- Couple of attributes there -->
> </xsd:complexType>
>
> <xsd:complexType name="datasType" ecore:name="datas">
> <xsd:sequence>
> <xsd:element minOccurs="1" maxOccurs="1" name="dataId"
> type="xsd:IDREF" ecore:reference="dataidtype"/>
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:complexType name="outputType" ecore:name="output">
> <xsd:sequence>
> <xsd:element minOccurs="0" maxOccurs="unbounded" name="XXX"
> type="dataidtype"/>
> </xsd:sequence>
> <!-- Couple of attributes there -->
> </xsd:complexType>
>
> <xsd:complexType name="dataidtype" ecore:name="dataId">
> <xsd:sequence>
> <xsd:element name="dataId" type="xsd:ID"/>
> </xsd:sequence>
> </xsd:complexType>
>
> Using this schema, I end up with the following generated XML code (via
> EMF):
>
> <output [.. some attributes...]>
> <XXX>
> <dataId>myDataId</dataId>
> </XXX>
> </output>
> <listeningdata [... some attributes ...]>
> <datas>
> <dataId>myDataId</dataId>
> </datas>
> </listeningdata>
>
> As you can guess, I would like to get rid of the XML element "XXX",
> but still would like to be able to include 'dataidtype' in 'output'.
> Eventually, is there a way not to make it appear during the XML
> generation?
> Any ideas?
Re: XML Generation and element hiding [message #67854 is a reply to message #67836] Fri, 21 April 2006 11:44 Go to previous messageGo to next message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Thanks for the suggestion, it always helps.

As for the goal, I actually would like, insides 'datas' to be able to
make a reference to a 'dataid' residing in a pool of 'dataid' defined
into the 'output'.

In other words, this is a simple 'calculator' I'd like the Schema to
reflect.

<process>
<output>dataIdC</output>
<input>dataIdB</input>

<process>
<output>dataIdB</output>
<input>dataIdA</input>
</process>
</process>

I thought the way I did it was the most relevant



Ed Merks a écrit :
> Guillaume,
>
> One suggestion. Data is plural for datum, so datas is kind of bad.
> Since you can't have multiple IDs for a given element, I'd need to know
> what goal you are trying to achieve by having what's effectively just a
> list of IDs.
>
>
> Guillaume Windels wrote:
>> Hello,
>>
>> I am looking for a way to simplify this bit of XML Schema. Namely, I
>> have an element which is not useful ("XXX"), but required ID-wise. The
>> purpose of this is to generate some XML.
>>
>>
>>
>> <xsd:complexType name="listeningDataType" ecore:name="listeningData">
>> <xsd:sequence>
>> <xsd:element minOccurs="1" maxOccurs="unbounded" name="datas"
>> type="datasType"/>
>> </xsd:sequence>
>> <!-- Couple of attributes there -->
>> </xsd:complexType>
>>
>> <xsd:complexType name="datasType" ecore:name="datas">
>> <xsd:sequence>
>> <xsd:element minOccurs="1" maxOccurs="1" name="dataId"
>> type="xsd:IDREF" ecore:reference="dataidtype"/>
>> </xsd:sequence>
>> </xsd:complexType>
>>
>> <xsd:complexType name="outputType" ecore:name="output">
>> <xsd:sequence>
>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="XXX"
>> type="dataidtype"/>
>> </xsd:sequence>
>> <!-- Couple of attributes there -->
>> </xsd:complexType>
>>
>> <xsd:complexType name="dataidtype" ecore:name="dataId">
>> <xsd:sequence>
>> <xsd:element name="dataId" type="xsd:ID"/>
>> </xsd:sequence> </xsd:complexType>
>>
>> Using this schema, I end up with the following generated XML code (via
>> EMF):
>>
>> <output [.. some attributes...]>
>> <XXX>
>> <dataId>myDataId</dataId>
>> </XXX>
>> </output>
>> <listeningdata [... some attributes ...]>
>> <datas>
>> <dataId>myDataId</dataId>
>> </datas>
>> </listeningdata>
>>
>> As you can guess, I would like to get rid of the XML element "XXX",
>> but still would like to be able to include 'dataidtype' in 'output'.
>> Eventually, is there a way not to make it appear during the XML
>> generation?
>> Any ideas?
Re: XML Generation and element hiding [message #67872 is a reply to message #67854] Fri, 21 April 2006 11:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Guillaume,

Perhaps what you want is a complex type with simple content that extends
ID as the base type. Note that using elements of type ID is permitted
but is specifically recommended against by the XML Schema specification.

<xsd:complexType name="SimpleContentComplexTypeDefinition">
<xsd:simpleContent>
<xsd:extension base="xsd:ID">
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>


Guillaume Windels wrote:
> Thanks for the suggestion, it always helps.
>
> As for the goal, I actually would like, insides 'datas' to be able to
> make a reference to a 'dataid' residing in a pool of 'dataid' defined
> into the 'output'.
>
> In other words, this is a simple 'calculator' I'd like the Schema to
> reflect.
>
> <process>
> <output>dataIdC</output>
> <input>dataIdB</input>
>
> <process>
> <output>dataIdB</output>
> <input>dataIdA</input>
> </process>
> </process>
>
> I thought the way I did it was the most relevant
>
>
>
> Ed Merks a écrit :
>> Guillaume,
>>
>> One suggestion. Data is plural for datum, so datas is kind of bad.
>> Since you can't have multiple IDs for a given element, I'd need to
>> know what goal you are trying to achieve by having what's effectively
>> just a list of IDs.
>>
>>
>> Guillaume Windels wrote:
>>> Hello,
>>>
>>> I am looking for a way to simplify this bit of XML Schema. Namely, I
>>> have an element which is not useful ("XXX"), but required ID-wise.
>>> The purpose of this is to generate some XML.
>>>
>>>
>>>
>>> <xsd:complexType name="listeningDataType" ecore:name="listeningData">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="1" maxOccurs="unbounded" name="datas"
>>> type="datasType"/>
>>> </xsd:sequence>
>>> <!-- Couple of attributes there -->
>>> </xsd:complexType>
>>>
>>> <xsd:complexType name="datasType" ecore:name="datas">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="1" maxOccurs="1" name="dataId"
>>> type="xsd:IDREF" ecore:reference="dataidtype"/>
>>> </xsd:sequence>
>>> </xsd:complexType>
>>>
>>> <xsd:complexType name="outputType" ecore:name="output">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="XXX"
>>> type="dataidtype"/>
>>> </xsd:sequence>
>>> <!-- Couple of attributes there -->
>>> </xsd:complexType>
>>>
>>> <xsd:complexType name="dataidtype" ecore:name="dataId">
>>> <xsd:sequence>
>>> <xsd:element name="dataId" type="xsd:ID"/>
>>> </xsd:sequence> </xsd:complexType>
>>>
>>> Using this schema, I end up with the following generated XML code
>>> (via EMF):
>>>
>>> <output [.. some attributes...]>
>>> <XXX>
>>> <dataId>myDataId</dataId>
>>> </XXX>
>>> </output>
>>> <listeningdata [... some attributes ...]>
>>> <datas>
>>> <dataId>myDataId</dataId>
>>> </datas>
>>> </listeningdata>
>>>
>>> As you can guess, I would like to get rid of the XML element "XXX",
>>> but still would like to be able to include 'dataidtype' in 'output'.
>>> Eventually, is there a way not to make it appear during the XML
>>> generation?
>>> Any ideas?
Re: XML Generation and element hiding [message #68077 is a reply to message #67872] Tue, 09 May 2006 14:13 Go to previous messageGo to next message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Ed,

"Note that using elements of type ID is permitted but is specifically
recommended against by the XML Schema specification."

Thanks, is there an explanation for that?

How about IDREF?


Ed Merks a écrit :
> Guillaume,
>
> Perhaps what you want is a complex type with simple content that extends
> ID as the base type. Note that using elements of type ID is permitted
> but is specifically recommended against by the XML Schema specification.
> <xsd:complexType name="SimpleContentComplexTypeDefinition">
> <xsd:simpleContent>
> <xsd:extension base="xsd:ID">
> </xsd:extension>
> </xsd:simpleContent>
> </xsd:complexType>
>
>
> Guillaume Windels wrote:
>> Thanks for the suggestion, it always helps.
>>
>> As for the goal, I actually would like, insides 'datas' to be able to
>> make a reference to a 'dataid' residing in a pool of 'dataid' defined
>> into the 'output'.
>>
>> In other words, this is a simple 'calculator' I'd like the Schema to
>> reflect.
>>
>> <process>
>> <output>dataIdC</output>
>> <input>dataIdB</input>
>>
>> <process>
>> <output>dataIdB</output>
>> <input>dataIdA</input>
>> </process>
>> </process>
>>
>> I thought the way I did it was the most relevant
>>
>>
>>
>> Ed Merks a écrit :
>>> Guillaume,
>>>
>>> One suggestion. Data is plural for datum, so datas is kind of bad.
>>> Since you can't have multiple IDs for a given element, I'd need to
>>> know what goal you are trying to achieve by having what's effectively
>>> just a list of IDs.
>>>
>>>
>>> Guillaume Windels wrote:
>>>> Hello,
>>>>
>>>> I am looking for a way to simplify this bit of XML Schema. Namely, I
>>>> have an element which is not useful ("XXX"), but required ID-wise.
>>>> The purpose of this is to generate some XML.
>>>>
>>>>
>>>>
>>>> <xsd:complexType name="listeningDataType" ecore:name="listeningData">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="1" maxOccurs="unbounded" name="datas"
>>>> type="datasType"/>
>>>> </xsd:sequence>
>>>> <!-- Couple of attributes there -->
>>>> </xsd:complexType>
>>>>
>>>> <xsd:complexType name="datasType" ecore:name="datas">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="1" maxOccurs="1" name="dataId"
>>>> type="xsd:IDREF" ecore:reference="dataidtype"/>
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>>
>>>> <xsd:complexType name="outputType" ecore:name="output">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="XXX"
>>>> type="dataidtype"/>
>>>> </xsd:sequence>
>>>> <!-- Couple of attributes there -->
>>>> </xsd:complexType>
>>>>
>>>> <xsd:complexType name="dataidtype" ecore:name="dataId">
>>>> <xsd:sequence>
>>>> <xsd:element name="dataId" type="xsd:ID"/>
>>>> </xsd:sequence> </xsd:complexType>
>>>>
>>>> Using this schema, I end up with the following generated XML code
>>>> (via EMF):
>>>>
>>>> <output [.. some attributes...]>
>>>> <XXX>
>>>> <dataId>myDataId</dataId>
>>>> </XXX>
>>>> </output>
>>>> <listeningdata [... some attributes ...]>
>>>> <datas>
>>>> <dataId>myDataId</dataId>
>>>> </datas>
>>>> </listeningdata>
>>>>
>>>> As you can guess, I would like to get rid of the XML element "XXX",
>>>> but still would like to be able to include 'dataidtype' in 'output'.
>>>> Eventually, is there a way not to make it appear during the XML
>>>> generation?
>>>> Any ideas?
Re: XML Generation and element hiding [message #68093 is a reply to message #68077] Tue, 09 May 2006 15:20 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------050902010907020602040300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Guillaume,

The spec says the same thing for IDREF
http://www.w3.org/TR/xmlschema-2/#IDREF:

For compatibility (see Terminology (
Re: XML Generation and element hiding [message #597995 is a reply to message #67811] Fri, 21 April 2006 11:13 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Guillaume,

One suggestion. Data is plural for datum, so datas is kind of bad.

Since you can't have multiple IDs for a given element, I'd need to know
what goal you are trying to achieve by having what's effectively just a
list of IDs.


Guillaume Windels wrote:
> Hello,
>
> I am looking for a way to simplify this bit of XML Schema. Namely, I
> have an element which is not useful ("XXX"), but required ID-wise. The
> purpose of this is to generate some XML.
>
>
>
> <xsd:complexType name="listeningDataType" ecore:name="listeningData">
> <xsd:sequence>
> <xsd:element minOccurs="1" maxOccurs="unbounded" name="datas"
> type="datasType"/>
> </xsd:sequence>
> <!-- Couple of attributes there -->
> </xsd:complexType>
>
> <xsd:complexType name="datasType" ecore:name="datas">
> <xsd:sequence>
> <xsd:element minOccurs="1" maxOccurs="1" name="dataId"
> type="xsd:IDREF" ecore:reference="dataidtype"/>
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:complexType name="outputType" ecore:name="output">
> <xsd:sequence>
> <xsd:element minOccurs="0" maxOccurs="unbounded" name="XXX"
> type="dataidtype"/>
> </xsd:sequence>
> <!-- Couple of attributes there -->
> </xsd:complexType>
>
> <xsd:complexType name="dataidtype" ecore:name="dataId">
> <xsd:sequence>
> <xsd:element name="dataId" type="xsd:ID"/>
> </xsd:sequence>
> </xsd:complexType>
>
> Using this schema, I end up with the following generated XML code (via
> EMF):
>
> <output [.. some attributes...]>
> <XXX>
> <dataId>myDataId</dataId>
> </XXX>
> </output>
> <listeningdata [... some attributes ...]>
> <datas>
> <dataId>myDataId</dataId>
> </datas>
> </listeningdata>
>
> As you can guess, I would like to get rid of the XML element "XXX",
> but still would like to be able to include 'dataidtype' in 'output'.
> Eventually, is there a way not to make it appear during the XML
> generation?
> Any ideas?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XML Generation and element hiding [message #598001 is a reply to message #67836] Fri, 21 April 2006 11:44 Go to previous message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Thanks for the suggestion, it always helps.

As for the goal, I actually would like, insides 'datas' to be able to
make a reference to a 'dataid' residing in a pool of 'dataid' defined
into the 'output'.

In other words, this is a simple 'calculator' I'd like the Schema to
reflect.

<process>
<output>dataIdC</output>
<input>dataIdB</input>

<process>
<output>dataIdB</output>
<input>dataIdA</input>
</process>
</process>

I thought the way I did it was the most relevant



Ed Merks a écrit :
> Guillaume,
>
> One suggestion. Data is plural for datum, so datas is kind of bad.
> Since you can't have multiple IDs for a given element, I'd need to know
> what goal you are trying to achieve by having what's effectively just a
> list of IDs.
>
>
> Guillaume Windels wrote:
>> Hello,
>>
>> I am looking for a way to simplify this bit of XML Schema. Namely, I
>> have an element which is not useful ("XXX"), but required ID-wise. The
>> purpose of this is to generate some XML.
>>
>>
>>
>> <xsd:complexType name="listeningDataType" ecore:name="listeningData">
>> <xsd:sequence>
>> <xsd:element minOccurs="1" maxOccurs="unbounded" name="datas"
>> type="datasType"/>
>> </xsd:sequence>
>> <!-- Couple of attributes there -->
>> </xsd:complexType>
>>
>> <xsd:complexType name="datasType" ecore:name="datas">
>> <xsd:sequence>
>> <xsd:element minOccurs="1" maxOccurs="1" name="dataId"
>> type="xsd:IDREF" ecore:reference="dataidtype"/>
>> </xsd:sequence>
>> </xsd:complexType>
>>
>> <xsd:complexType name="outputType" ecore:name="output">
>> <xsd:sequence>
>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="XXX"
>> type="dataidtype"/>
>> </xsd:sequence>
>> <!-- Couple of attributes there -->
>> </xsd:complexType>
>>
>> <xsd:complexType name="dataidtype" ecore:name="dataId">
>> <xsd:sequence>
>> <xsd:element name="dataId" type="xsd:ID"/>
>> </xsd:sequence> </xsd:complexType>
>>
>> Using this schema, I end up with the following generated XML code (via
>> EMF):
>>
>> <output [.. some attributes...]>
>> <XXX>
>> <dataId>myDataId</dataId>
>> </XXX>
>> </output>
>> <listeningdata [... some attributes ...]>
>> <datas>
>> <dataId>myDataId</dataId>
>> </datas>
>> </listeningdata>
>>
>> As you can guess, I would like to get rid of the XML element "XXX",
>> but still would like to be able to include 'dataidtype' in 'output'.
>> Eventually, is there a way not to make it appear during the XML
>> generation?
>> Any ideas?
Re: XML Generation and element hiding [message #598008 is a reply to message #67854] Fri, 21 April 2006 11:55 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Guillaume,

Perhaps what you want is a complex type with simple content that extends
ID as the base type. Note that using elements of type ID is permitted
but is specifically recommended against by the XML Schema specification.

<xsd:complexType name="SimpleContentComplexTypeDefinition">
<xsd:simpleContent>
<xsd:extension base="xsd:ID">
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>


Guillaume Windels wrote:
> Thanks for the suggestion, it always helps.
>
> As for the goal, I actually would like, insides 'datas' to be able to
> make a reference to a 'dataid' residing in a pool of 'dataid' defined
> into the 'output'.
>
> In other words, this is a simple 'calculator' I'd like the Schema to
> reflect.
>
> <process>
> <output>dataIdC</output>
> <input>dataIdB</input>
>
> <process>
> <output>dataIdB</output>
> <input>dataIdA</input>
> </process>
> </process>
>
> I thought the way I did it was the most relevant
>
>
>
> Ed Merks a écrit :
>> Guillaume,
>>
>> One suggestion. Data is plural for datum, so datas is kind of bad.
>> Since you can't have multiple IDs for a given element, I'd need to
>> know what goal you are trying to achieve by having what's effectively
>> just a list of IDs.
>>
>>
>> Guillaume Windels wrote:
>>> Hello,
>>>
>>> I am looking for a way to simplify this bit of XML Schema. Namely, I
>>> have an element which is not useful ("XXX"), but required ID-wise.
>>> The purpose of this is to generate some XML.
>>>
>>>
>>>
>>> <xsd:complexType name="listeningDataType" ecore:name="listeningData">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="1" maxOccurs="unbounded" name="datas"
>>> type="datasType"/>
>>> </xsd:sequence>
>>> <!-- Couple of attributes there -->
>>> </xsd:complexType>
>>>
>>> <xsd:complexType name="datasType" ecore:name="datas">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="1" maxOccurs="1" name="dataId"
>>> type="xsd:IDREF" ecore:reference="dataidtype"/>
>>> </xsd:sequence>
>>> </xsd:complexType>
>>>
>>> <xsd:complexType name="outputType" ecore:name="output">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="XXX"
>>> type="dataidtype"/>
>>> </xsd:sequence>
>>> <!-- Couple of attributes there -->
>>> </xsd:complexType>
>>>
>>> <xsd:complexType name="dataidtype" ecore:name="dataId">
>>> <xsd:sequence>
>>> <xsd:element name="dataId" type="xsd:ID"/>
>>> </xsd:sequence> </xsd:complexType>
>>>
>>> Using this schema, I end up with the following generated XML code
>>> (via EMF):
>>>
>>> <output [.. some attributes...]>
>>> <XXX>
>>> <dataId>myDataId</dataId>
>>> </XXX>
>>> </output>
>>> <listeningdata [... some attributes ...]>
>>> <datas>
>>> <dataId>myDataId</dataId>
>>> </datas>
>>> </listeningdata>
>>>
>>> As you can guess, I would like to get rid of the XML element "XXX",
>>> but still would like to be able to include 'dataidtype' in 'output'.
>>> Eventually, is there a way not to make it appear during the XML
>>> generation?
>>> Any ideas?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XML Generation and element hiding [message #598064 is a reply to message #67872] Tue, 09 May 2006 14:13 Go to previous message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Ed,

"Note that using elements of type ID is permitted but is specifically
recommended against by the XML Schema specification."

Thanks, is there an explanation for that?

How about IDREF?


Ed Merks a écrit :
> Guillaume,
>
> Perhaps what you want is a complex type with simple content that extends
> ID as the base type. Note that using elements of type ID is permitted
> but is specifically recommended against by the XML Schema specification.
> <xsd:complexType name="SimpleContentComplexTypeDefinition">
> <xsd:simpleContent>
> <xsd:extension base="xsd:ID">
> </xsd:extension>
> </xsd:simpleContent>
> </xsd:complexType>
>
>
> Guillaume Windels wrote:
>> Thanks for the suggestion, it always helps.
>>
>> As for the goal, I actually would like, insides 'datas' to be able to
>> make a reference to a 'dataid' residing in a pool of 'dataid' defined
>> into the 'output'.
>>
>> In other words, this is a simple 'calculator' I'd like the Schema to
>> reflect.
>>
>> <process>
>> <output>dataIdC</output>
>> <input>dataIdB</input>
>>
>> <process>
>> <output>dataIdB</output>
>> <input>dataIdA</input>
>> </process>
>> </process>
>>
>> I thought the way I did it was the most relevant
>>
>>
>>
>> Ed Merks a écrit :
>>> Guillaume,
>>>
>>> One suggestion. Data is plural for datum, so datas is kind of bad.
>>> Since you can't have multiple IDs for a given element, I'd need to
>>> know what goal you are trying to achieve by having what's effectively
>>> just a list of IDs.
>>>
>>>
>>> Guillaume Windels wrote:
>>>> Hello,
>>>>
>>>> I am looking for a way to simplify this bit of XML Schema. Namely, I
>>>> have an element which is not useful ("XXX"), but required ID-wise.
>>>> The purpose of this is to generate some XML.
>>>>
>>>>
>>>>
>>>> <xsd:complexType name="listeningDataType" ecore:name="listeningData">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="1" maxOccurs="unbounded" name="datas"
>>>> type="datasType"/>
>>>> </xsd:sequence>
>>>> <!-- Couple of attributes there -->
>>>> </xsd:complexType>
>>>>
>>>> <xsd:complexType name="datasType" ecore:name="datas">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="1" maxOccurs="1" name="dataId"
>>>> type="xsd:IDREF" ecore:reference="dataidtype"/>
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>>
>>>> <xsd:complexType name="outputType" ecore:name="output">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="0" maxOccurs="unbounded" name="XXX"
>>>> type="dataidtype"/>
>>>> </xsd:sequence>
>>>> <!-- Couple of attributes there -->
>>>> </xsd:complexType>
>>>>
>>>> <xsd:complexType name="dataidtype" ecore:name="dataId">
>>>> <xsd:sequence>
>>>> <xsd:element name="dataId" type="xsd:ID"/>
>>>> </xsd:sequence> </xsd:complexType>
>>>>
>>>> Using this schema, I end up with the following generated XML code
>>>> (via EMF):
>>>>
>>>> <output [.. some attributes...]>
>>>> <XXX>
>>>> <dataId>myDataId</dataId>
>>>> </XXX>
>>>> </output>
>>>> <listeningdata [... some attributes ...]>
>>>> <datas>
>>>> <dataId>myDataId</dataId>
>>>> </datas>
>>>> </listeningdata>
>>>>
>>>> As you can guess, I would like to get rid of the XML element "XXX",
>>>> but still would like to be able to include 'dataidtype' in 'output'.
>>>> Eventually, is there a way not to make it appear during the XML
>>>> generation?
>>>> Any ideas?
Re: XML Generation and element hiding [message #598070 is a reply to message #68077] Tue, 09 May 2006 15:20 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050902010907020602040300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Guillaume,

The spec says the same thing for IDREF
http://www.w3.org/TR/xmlschema-2/#IDREF:

For compatibility (see Terminology (


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:XSDImporter.java cannot run headless
Next Topic:getFacets() Vs getFacetContents()
Goto Forum:
  


Current Time: Fri Mar 29 01:53:46 GMT 2024

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

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

Back to the top