Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Embedded elements
Embedded elements [message #67497] Mon, 10 April 2006 20:08 Go to next message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
I am trying to build a XML Schema to then being able to generate a XML
file that would look like this:

<root>

<process>
<input>
<data>blah</data>
</input>

<output>
<data>bloh</data>
</output>


<process>
<output>
<data>blah</data>
</output>
</process>
</process>



</root>

As you can see, a <process> produces <output>s, uses <input>, and can
contain itself. My question is, how can we render, in XSD, the fact that
a <data> can be reused in two different objects?

Cheers -
Re: Embedded elements [message #67519 is a reply to message #67497] Mon, 10 April 2006 20:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Guillaume,

Define it as a global element and use <element ref="..."/> to refer to
it in multiple complex types.


Guillaume Windels wrote:

> I am trying to build a XML Schema to then being able to generate a XML
> file that would look like this:
>
> <root>
>
> <process>
> <input>
> <data>blah</data>
> </input>
>
> <output>
> <data>bloh</data>
> </output>
>
>
> <process>
> <output>
> <data>blah</data>
> </output>
> </process>
> </process>
>
>
>
> </root>
>
> As you can see, a <process> produces <output>s, uses <input>, and can
> contain itself. My question is, how can we render, in XSD, the fact
> that a <data> can be reused in two different objects?
>
> Cheers -
Re: Embedded elements [message #67539 is a reply to message #67519] Tue, 11 April 2006 08:27 Go to previous messageGo to next message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Thanks Ed.

Using a global element, would I still be able to add a reference to it
since a <data> element is used by both <input> and <output>?

Ed Merks a écrit :
> Guillaume,
>
> Define it as a global element and use <element ref="..."/> to refer to
> it in multiple complex types.
>
>
> Guillaume Windels wrote:
>
>> I am trying to build a XML Schema to then being able to generate a XML
>> file that would look like this:
>>
>> <root>
>>
>> <process>
>> <input>
>> <data>blah</data>
>> </input>
>>
>> <output>
>> <data>bloh</data>
>> </output>
>>
>>
>> <process>
>> <output>
>> <data>blah</data>
>> </output>
>> </process>
>> </process>
>>
>>
>>
>> </root>
>>
>> As you can see, a <process> produces <output>s, uses <input>, and can
>> contain itself. My question is, how can we render, in XSD, the fact
>> that a <data> can be reused in two different objects?
>>
>> Cheers -
>
Re: Embedded elements [message #67560 is a reply to message #67539] Tue, 11 April 2006 09:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Guillaume,

A global element can be referenced anywhere. A different approach is to
define global types and to reuse those. I.e., each occurrence of <data>
could be specified with a different local element declaration that
references the same globally defined type.


Guillaume Windels wrote:
> Thanks Ed.
>
> Using a global element, would I still be able to add a reference to it
> since a <data> element is used by both <input> and <output>?
>
> Ed Merks a écrit :
>> Guillaume,
>>
>> Define it as a global element and use <element ref="..."/> to refer
>> to it in multiple complex types.
>>
>>
>> Guillaume Windels wrote:
>>
>>> I am trying to build a XML Schema to then being able to generate a
>>> XML file that would look like this:
>>>
>>> <root>
>>>
>>> <process>
>>> <input>
>>> <data>blah</data>
>>> </input>
>>>
>>> <output>
>>> <data>bloh</data>
>>> </output>
>>>
>>>
>>> <process>
>>> <output>
>>> <data>blah</data>
>>> </output>
>>> </process>
>>> </process>
>>>
>>>
>>>
>>> </root>
>>>
>>> As you can see, a <process> produces <output>s, uses <input>, and
>>> can contain itself. My question is, how can we render, in XSD, the
>>> fact that a <data> can be reused in two different objects?
>>>
>>> Cheers -
>>
Re: Embedded elements [message #67589 is a reply to message #67560] Tue, 11 April 2006 10:21 Go to previous messageGo to next message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
That's fair enough.

However, defining a global element seems to mix up with the root
element. How can you tell you schema that a global element should not
have such behaviour?

Let me clarify that.

This is the start of my XML Schema:
<xsd:element name="processGroup" type="proc:processGroup"/>

<xsd:element name="dataId" type="xsd:string"/>

<xsd:complexType name="processGroup">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
type="proc:process"/>
</xsd:sequence>
</xsd:complexType>

....

----------------------------------------

In the schema, <dataId> stands for <data> (as discussed earlier).

Take a look at the following screenshot:
http://img84.imageshack.us/img84/5367/dataid8lp.jpg

ProcessModel1 is the DocumentRoot. How could you explain there is a link
between ProcessModel1 and dataId?

Ed Merks a écrit :
> Guillaume,
>
> A global element can be referenced anywhere. A different approach is to
> define global types and to reuse those. I.e., each occurrence of <data>
> could be specified with a different local element declaration that
> references the same globally defined type.
>
>
> Guillaume Windels wrote:
>> Thanks Ed.
>>
>> Using a global element, would I still be able to add a reference to it
>> since a <data> element is used by both <input> and <output>?
>>
>> Ed Merks a écrit :
>>> Guillaume,
>>>
>>> Define it as a global element and use <element ref="..."/> to refer
>>> to it in multiple complex types.
>>>
>>>
>>> Guillaume Windels wrote:
>>>
>>>> I am trying to build a XML Schema to then being able to generate a
>>>> XML file that would look like this:
>>>>
>>>> <root>
>>>>
>>>> <process>
>>>> <input>
>>>> <data>blah</data>
>>>> </input>
>>>>
>>>> <output>
>>>> <data>bloh</data>
>>>> </output>
>>>>
>>>>
>>>> <process>
>>>> <output>
>>>> <data>blah</data>
>>>> </output>
>>>> </process>
>>>> </process>
>>>>
>>>>
>>>>
>>>> </root>
>>>>
>>>> As you can see, a <process> produces <output>s, uses <input>, and
>>>> can contain itself. My question is, how can we render, in XSD, the
>>>> fact that a <data> can be reused in two different objects?
>>>>
>>>> Cheers -
>>>
Re: Embedded elements [message #67610 is a reply to message #67589] Tue, 11 April 2006 11:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Guillaume,

Comments below.

Guillaume Windels wrote:
> That's fair enough.
>
> However, defining a global element seems to mix up with the root element.
Root element is not a term that has meaning in the XML Schema specification.
> How can you tell you schema that a global element should not have such
> behaviour?
Since it doesn't mean anything to an XML Schema, you can't preclude such
behavior. As such, if you only want to have a single global element
declaration to represent the one and only valid root element of a
document, you'll need to avoid global element declarations for all other
cases. That's where having local element declarations of some shared
global type should help you...
>
> Let me clarify that.
>
> This is the start of my XML Schema:
> <xsd:element name="processGroup" type="proc:processGroup"/>
>
> <xsd:element name="dataId" type="xsd:string"/>
>
> <xsd:complexType name="processGroup">
> <xsd:sequence>
> <xsd:element name="name" type="xsd:string"/>
> <xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
> type="proc:process"/>
> </xsd:sequence>
> </xsd:complexType>
>
> ...
>
> ----------------------------------------
>
> In the schema, <dataId> stands for <data> (as discussed earlier).
>
> Take a look at the following screenshot:
> http://img84.imageshack.us/img84/5367/dataid8lp.jpg
>
> ProcessModel1 is the DocumentRoot. How could you explain there is a
> link between ProcessModel1 and dataId?
>
> Ed Merks a écrit :
>> Guillaume,
>>
>> A global element can be referenced anywhere. A different approach is
>> to define global types and to reuse those. I.e., each occurrence of
>> <data> could be specified with a different local element declaration
>> that references the same globally defined type.
>>
>>
>> Guillaume Windels wrote:
>>> Thanks Ed.
>>>
>>> Using a global element, would I still be able to add a reference to
>>> it since a <data> element is used by both <input> and <output>?
>>>
>>> Ed Merks a écrit :
>>>> Guillaume,
>>>>
>>>> Define it as a global element and use <element ref="..."/> to refer
>>>> to it in multiple complex types.
>>>>
>>>>
>>>> Guillaume Windels wrote:
>>>>
>>>>> I am trying to build a XML Schema to then being able to generate a
>>>>> XML file that would look like this:
>>>>>
>>>>> <root>
>>>>>
>>>>> <process>
>>>>> <input>
>>>>> <data>blah</data>
>>>>> </input>
>>>>>
>>>>> <output>
>>>>> <data>bloh</data>
>>>>> </output>
>>>>>
>>>>>
>>>>> <process>
>>>>> <output>
>>>>> <data>blah</data>
>>>>> </output>
>>>>> </process>
>>>>> </process>
>>>>>
>>>>>
>>>>>
>>>>> </root>
>>>>>
>>>>> As you can see, a <process> produces <output>s, uses <input>, and
>>>>> can contain itself. My question is, how can we render, in XSD, the
>>>>> fact that a <data> can be reused in two different objects?
>>>>>
>>>>> Cheers -
>>>>
Re: Embedded elements [message #67628 is a reply to message #67610] Tue, 11 April 2006 11:19 Go to previous messageGo to next message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Ed,

"That's where having local element declarations of some shared global
type should help you..."

Would you mind illustrating that?



Ed Merks a écrit :
> Guillaume,
>
> Comments below.
>
> Guillaume Windels wrote:
>> That's fair enough.
>>
>> However, defining a global element seems to mix up with the root element.
> Root element is not a term that has meaning in the XML Schema
> specification.
>> How can you tell you schema that a global element should not have such
>> behaviour?
> Since it doesn't mean anything to an XML Schema, you can't preclude such
> behavior. As such, if you only want to have a single global element
> declaration to represent the one and only valid root element of a
> document, you'll need to avoid global element declarations for all other
> cases. That's where having local element declarations of some shared
> global type should help you...
>>
>> Let me clarify that.
>>
>> This is the start of my XML Schema:
>> <xsd:element name="processGroup" type="proc:processGroup"/>
>>
>> <xsd:element name="dataId" type="xsd:string"/>
>>
>> <xsd:complexType name="processGroup">
>> <xsd:sequence>
>> <xsd:element name="name" type="xsd:string"/>
>> <xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
>> type="proc:process"/>
>> </xsd:sequence>
>> </xsd:complexType>
>>
>> ...
>>
>> ----------------------------------------
>>
>> In the schema, <dataId> stands for <data> (as discussed earlier).
>>
>> Take a look at the following screenshot:
>> http://img84.imageshack.us/img84/5367/dataid8lp.jpg
>>
>> ProcessModel1 is the DocumentRoot. How could you explain there is a
>> link between ProcessModel1 and dataId?
>>
>> Ed Merks a écrit :
>>> Guillaume,
>>>
>>> A global element can be referenced anywhere. A different approach is
>>> to define global types and to reuse those. I.e., each occurrence of
>>> <data> could be specified with a different local element declaration
>>> that references the same globally defined type.
>>>
>>>
>>> Guillaume Windels wrote:
>>>> Thanks Ed.
>>>>
>>>> Using a global element, would I still be able to add a reference to
>>>> it since a <data> element is used by both <input> and <output>?
>>>>
>>>> Ed Merks a écrit :
>>>>> Guillaume,
>>>>>
>>>>> Define it as a global element and use <element ref="..."/> to refer
>>>>> to it in multiple complex types.
>>>>>
>>>>>
>>>>> Guillaume Windels wrote:
>>>>>
>>>>>> I am trying to build a XML Schema to then being able to generate a
>>>>>> XML file that would look like this:
>>>>>>
>>>>>> <root>
>>>>>>
>>>>>> <process>
>>>>>> <input>
>>>>>> <data>blah</data>
>>>>>> </input>
>>>>>>
>>>>>> <output>
>>>>>> <data>bloh</data>
>>>>>> </output>
>>>>>>
>>>>>>
>>>>>> <process>
>>>>>> <output>
>>>>>> <data>blah</data>
>>>>>> </output>
>>>>>> </process>
>>>>>> </process>
>>>>>>
>>>>>>
>>>>>>
>>>>>> </root>
>>>>>>
>>>>>> As you can see, a <process> produces <output>s, uses <input>, and
>>>>>> can contain itself. My question is, how can we render, in XSD, the
>>>>>> fact that a <data> can be reused in two different objects?
>>>>>>
>>>>>> Cheers -
>>>>>
Re: Embedded elements [message #67651 is a reply to message #67628] Tue, 11 April 2006 11:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

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

Guillaume,

Your own example below is an example, i.e., process is a local element
that uses a globally defined type.

<xsd:element name="processGroup" type="proc:processGroup"/>

<xsd:element name="dataId" type="xsd:string"/>

<xsd:complexType name="processGroup">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
* <xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
type="proc:process"/> *
</xsd:sequence>


Guillaume Windels wrote:
> Ed,
>
> "That's where having local element declarations of some shared global
> type should help you..."
>
> Would you mind illustrating that?
>
>
>
> Ed Merks a
Re: Embedded elements [message #67667 is a reply to message #67651] Tue, 11 April 2006 11:28 Go to previous message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Thanks Ed, it makes sense now!

Ed Merks a écrit :
> Guillaume,
>
> Your own example below is an example, i.e., process is a local element
> that uses a globally defined type.
>
> <xsd:element name="processGroup" type="proc:processGroup"/>
>
> <xsd:element name="dataId" type="xsd:string"/>
>
> <xsd:complexType name="processGroup">
> <xsd:sequence>
> <xsd:element name="name" type="xsd:string"/>
> * <xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
> type="proc:process"/> *
> </xsd:sequence>
>
>
> Guillaume Windels wrote:
>> Ed,
>>
>> "That's where having local element declarations of some shared global
>> type should help you..."
>>
>> Would you mind illustrating that?
>>
>>
>>
>> Ed Merks a écrit :
>>> Guillaume,
>>>
>>> Comments below.
>>>
>>> Guillaume Windels wrote:
>>>> That's fair enough.
>>>>
>>>> However, defining a global element seems to mix up with the root
>>>> element.
>>> Root element is not a term that has meaning in the XML Schema
>>> specification.
>>>> How can you tell you schema that a global element should not have
>>>> such behaviour?
>>> Since it doesn't mean anything to an XML Schema, you can't preclude
>>> such behavior. As such, if you only want to have a single global
>>> element declaration to represent the one and only valid root element
>>> of a document, you'll need to avoid global element declarations for
>>> all other cases. That's where having local element declarations of
>>> some shared global type should help you...
>>>>
>>>> Let me clarify that.
>>>>
>>>> This is the start of my XML Schema:
>>>> <xsd:element name="processGroup" type="proc:processGroup"/>
>>>>
>>>> <xsd:element name="dataId" type="xsd:string"/>
>>>>
>>>> <xsd:complexType name="processGroup">
>>>> <xsd:sequence>
>>>> <xsd:element name="name" type="xsd:string"/>
>>>> <xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
>>>> type="proc:process"/>
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>>
>>>> ...
>>>>
>>>> ----------------------------------------
>>>>
>>>> In the schema, <dataId> stands for <data> (as discussed earlier).
>>>>
>>>> Take a look at the following screenshot:
>>>> http://img84.imageshack.us/img84/5367/dataid8lp.jpg
>>>>
>>>> ProcessModel1 is the DocumentRoot. How could you explain there is a
>>>> link between ProcessModel1 and dataId?
>>>>
>>>> Ed Merks a écrit :
>>>>> Guillaume,
>>>>>
>>>>> A global element can be referenced anywhere. A different approach
>>>>> is to define global types and to reuse those. I.e., each
>>>>> occurrence of <data> could be specified with a different local
>>>>> element declaration that references the same globally defined type.
>>>>>
>>>>>
>>>>> Guillaume Windels wrote:
>>>>>> Thanks Ed.
>>>>>>
>>>>>> Using a global element, would I still be able to add a reference
>>>>>> to it since a <data> element is used by both <input> and <output>?
>>>>>>
>>>>>> Ed Merks a écrit :
>>>>>>> Guillaume,
>>>>>>>
>>>>>>> Define it as a global element and use <element ref="..."/> to
>>>>>>> refer to it in multiple complex types.
>>>>>>>
>>>>>>>
>>>>>>> Guillaume Windels wrote:
>>>>>>>
>>>>>>>> I am trying to build a XML Schema to then being able to generate
>>>>>>>> a XML file that would look like this:
>>>>>>>>
>>>>>>>> <root>
>>>>>>>>
>>>>>>>> <process>
>>>>>>>> <input>
>>>>>>>> <data>blah</data>
>>>>>>>> </input>
>>>>>>>>
>>>>>>>> <output>
>>>>>>>> <data>bloh</data>
>>>>>>>> </output>
>>>>>>>>
>>>>>>>>
>>>>>>>> <process>
>>>>>>>> <output>
>>>>>>>> <data>blah</data>
>>>>>>>> </output>
>>>>>>>> </process>
>>>>>>>> </process>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> </root>
>>>>>>>>
>>>>>>>> As you can see, a <process> produces <output>s, uses <input>,
>>>>>>>> and can contain itself. My question is, how can we render, in
>>>>>>>> XSD, the fact that a <data> can be reused in two different objects?
>>>>>>>>
>>>>>>>> Cheers -
>>>>>>>
>
Re: Embedded elements [message #597902 is a reply to message #67497] Mon, 10 April 2006 20:14 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Guillaume,

Define it as a global element and use <element ref="..."/> to refer to
it in multiple complex types.


Guillaume Windels wrote:

> I am trying to build a XML Schema to then being able to generate a XML
> file that would look like this:
>
> <root>
>
> <process>
> <input>
> <data>blah</data>
> </input>
>
> <output>
> <data>bloh</data>
> </output>
>
>
> <process>
> <output>
> <data>blah</data>
> </output>
> </process>
> </process>
>
>
>
> </root>
>
> As you can see, a <process> produces <output>s, uses <input>, and can
> contain itself. My question is, how can we render, in XSD, the fact
> that a <data> can be reused in two different objects?
>
> Cheers -


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Embedded elements [message #597904 is a reply to message #67519] Tue, 11 April 2006 08:27 Go to previous message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Thanks Ed.

Using a global element, would I still be able to add a reference to it
since a <data> element is used by both <input> and <output>?

Ed Merks a écrit :
> Guillaume,
>
> Define it as a global element and use <element ref="..."/> to refer to
> it in multiple complex types.
>
>
> Guillaume Windels wrote:
>
>> I am trying to build a XML Schema to then being able to generate a XML
>> file that would look like this:
>>
>> <root>
>>
>> <process>
>> <input>
>> <data>blah</data>
>> </input>
>>
>> <output>
>> <data>bloh</data>
>> </output>
>>
>>
>> <process>
>> <output>
>> <data>blah</data>
>> </output>
>> </process>
>> </process>
>>
>>
>>
>> </root>
>>
>> As you can see, a <process> produces <output>s, uses <input>, and can
>> contain itself. My question is, how can we render, in XSD, the fact
>> that a <data> can be reused in two different objects?
>>
>> Cheers -
>
Re: Embedded elements [message #597914 is a reply to message #67539] Tue, 11 April 2006 09:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Guillaume,

A global element can be referenced anywhere. A different approach is to
define global types and to reuse those. I.e., each occurrence of <data>
could be specified with a different local element declaration that
references the same globally defined type.


Guillaume Windels wrote:
> Thanks Ed.
>
> Using a global element, would I still be able to add a reference to it
> since a <data> element is used by both <input> and <output>?
>
> Ed Merks a écrit :
>> Guillaume,
>>
>> Define it as a global element and use <element ref="..."/> to refer
>> to it in multiple complex types.
>>
>>
>> Guillaume Windels wrote:
>>
>>> I am trying to build a XML Schema to then being able to generate a
>>> XML file that would look like this:
>>>
>>> <root>
>>>
>>> <process>
>>> <input>
>>> <data>blah</data>
>>> </input>
>>>
>>> <output>
>>> <data>bloh</data>
>>> </output>
>>>
>>>
>>> <process>
>>> <output>
>>> <data>blah</data>
>>> </output>
>>> </process>
>>> </process>
>>>
>>>
>>>
>>> </root>
>>>
>>> As you can see, a <process> produces <output>s, uses <input>, and
>>> can contain itself. My question is, how can we render, in XSD, the
>>> fact that a <data> can be reused in two different objects?
>>>
>>> Cheers -
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Embedded elements [message #597918 is a reply to message #67560] Tue, 11 April 2006 10:21 Go to previous message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
That's fair enough.

However, defining a global element seems to mix up with the root
element. How can you tell you schema that a global element should not
have such behaviour?

Let me clarify that.

This is the start of my XML Schema:
<xsd:element name="processGroup" type="proc:processGroup"/>

<xsd:element name="dataId" type="xsd:string"/>

<xsd:complexType name="processGroup">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
type="proc:process"/>
</xsd:sequence>
</xsd:complexType>

....

----------------------------------------

In the schema, <dataId> stands for <data> (as discussed earlier).

Take a look at the following screenshot:
http://img84.imageshack.us/img84/5367/dataid8lp.jpg

ProcessModel1 is the DocumentRoot. How could you explain there is a link
between ProcessModel1 and dataId?

Ed Merks a écrit :
> Guillaume,
>
> A global element can be referenced anywhere. A different approach is to
> define global types and to reuse those. I.e., each occurrence of <data>
> could be specified with a different local element declaration that
> references the same globally defined type.
>
>
> Guillaume Windels wrote:
>> Thanks Ed.
>>
>> Using a global element, would I still be able to add a reference to it
>> since a <data> element is used by both <input> and <output>?
>>
>> Ed Merks a écrit :
>>> Guillaume,
>>>
>>> Define it as a global element and use <element ref="..."/> to refer
>>> to it in multiple complex types.
>>>
>>>
>>> Guillaume Windels wrote:
>>>
>>>> I am trying to build a XML Schema to then being able to generate a
>>>> XML file that would look like this:
>>>>
>>>> <root>
>>>>
>>>> <process>
>>>> <input>
>>>> <data>blah</data>
>>>> </input>
>>>>
>>>> <output>
>>>> <data>bloh</data>
>>>> </output>
>>>>
>>>>
>>>> <process>
>>>> <output>
>>>> <data>blah</data>
>>>> </output>
>>>> </process>
>>>> </process>
>>>>
>>>>
>>>>
>>>> </root>
>>>>
>>>> As you can see, a <process> produces <output>s, uses <input>, and
>>>> can contain itself. My question is, how can we render, in XSD, the
>>>> fact that a <data> can be reused in two different objects?
>>>>
>>>> Cheers -
>>>
Re: Embedded elements [message #597926 is a reply to message #67589] Tue, 11 April 2006 11:04 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Guillaume,

Comments below.

Guillaume Windels wrote:
> That's fair enough.
>
> However, defining a global element seems to mix up with the root element.
Root element is not a term that has meaning in the XML Schema specification.
> How can you tell you schema that a global element should not have such
> behaviour?
Since it doesn't mean anything to an XML Schema, you can't preclude such
behavior. As such, if you only want to have a single global element
declaration to represent the one and only valid root element of a
document, you'll need to avoid global element declarations for all other
cases. That's where having local element declarations of some shared
global type should help you...
>
> Let me clarify that.
>
> This is the start of my XML Schema:
> <xsd:element name="processGroup" type="proc:processGroup"/>
>
> <xsd:element name="dataId" type="xsd:string"/>
>
> <xsd:complexType name="processGroup">
> <xsd:sequence>
> <xsd:element name="name" type="xsd:string"/>
> <xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
> type="proc:process"/>
> </xsd:sequence>
> </xsd:complexType>
>
> ...
>
> ----------------------------------------
>
> In the schema, <dataId> stands for <data> (as discussed earlier).
>
> Take a look at the following screenshot:
> http://img84.imageshack.us/img84/5367/dataid8lp.jpg
>
> ProcessModel1 is the DocumentRoot. How could you explain there is a
> link between ProcessModel1 and dataId?
>
> Ed Merks a écrit :
>> Guillaume,
>>
>> A global element can be referenced anywhere. A different approach is
>> to define global types and to reuse those. I.e., each occurrence of
>> <data> could be specified with a different local element declaration
>> that references the same globally defined type.
>>
>>
>> Guillaume Windels wrote:
>>> Thanks Ed.
>>>
>>> Using a global element, would I still be able to add a reference to
>>> it since a <data> element is used by both <input> and <output>?
>>>
>>> Ed Merks a écrit :
>>>> Guillaume,
>>>>
>>>> Define it as a global element and use <element ref="..."/> to refer
>>>> to it in multiple complex types.
>>>>
>>>>
>>>> Guillaume Windels wrote:
>>>>
>>>>> I am trying to build a XML Schema to then being able to generate a
>>>>> XML file that would look like this:
>>>>>
>>>>> <root>
>>>>>
>>>>> <process>
>>>>> <input>
>>>>> <data>blah</data>
>>>>> </input>
>>>>>
>>>>> <output>
>>>>> <data>bloh</data>
>>>>> </output>
>>>>>
>>>>>
>>>>> <process>
>>>>> <output>
>>>>> <data>blah</data>
>>>>> </output>
>>>>> </process>
>>>>> </process>
>>>>>
>>>>>
>>>>>
>>>>> </root>
>>>>>
>>>>> As you can see, a <process> produces <output>s, uses <input>, and
>>>>> can contain itself. My question is, how can we render, in XSD, the
>>>>> fact that a <data> can be reused in two different objects?
>>>>>
>>>>> Cheers -
>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Embedded elements [message #597930 is a reply to message #67610] Tue, 11 April 2006 11:19 Go to previous message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Ed,

"That's where having local element declarations of some shared global
type should help you..."

Would you mind illustrating that?



Ed Merks a écrit :
> Guillaume,
>
> Comments below.
>
> Guillaume Windels wrote:
>> That's fair enough.
>>
>> However, defining a global element seems to mix up with the root element.
> Root element is not a term that has meaning in the XML Schema
> specification.
>> How can you tell you schema that a global element should not have such
>> behaviour?
> Since it doesn't mean anything to an XML Schema, you can't preclude such
> behavior. As such, if you only want to have a single global element
> declaration to represent the one and only valid root element of a
> document, you'll need to avoid global element declarations for all other
> cases. That's where having local element declarations of some shared
> global type should help you...
>>
>> Let me clarify that.
>>
>> This is the start of my XML Schema:
>> <xsd:element name="processGroup" type="proc:processGroup"/>
>>
>> <xsd:element name="dataId" type="xsd:string"/>
>>
>> <xsd:complexType name="processGroup">
>> <xsd:sequence>
>> <xsd:element name="name" type="xsd:string"/>
>> <xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
>> type="proc:process"/>
>> </xsd:sequence>
>> </xsd:complexType>
>>
>> ...
>>
>> ----------------------------------------
>>
>> In the schema, <dataId> stands for <data> (as discussed earlier).
>>
>> Take a look at the following screenshot:
>> http://img84.imageshack.us/img84/5367/dataid8lp.jpg
>>
>> ProcessModel1 is the DocumentRoot. How could you explain there is a
>> link between ProcessModel1 and dataId?
>>
>> Ed Merks a écrit :
>>> Guillaume,
>>>
>>> A global element can be referenced anywhere. A different approach is
>>> to define global types and to reuse those. I.e., each occurrence of
>>> <data> could be specified with a different local element declaration
>>> that references the same globally defined type.
>>>
>>>
>>> Guillaume Windels wrote:
>>>> Thanks Ed.
>>>>
>>>> Using a global element, would I still be able to add a reference to
>>>> it since a <data> element is used by both <input> and <output>?
>>>>
>>>> Ed Merks a écrit :
>>>>> Guillaume,
>>>>>
>>>>> Define it as a global element and use <element ref="..."/> to refer
>>>>> to it in multiple complex types.
>>>>>
>>>>>
>>>>> Guillaume Windels wrote:
>>>>>
>>>>>> I am trying to build a XML Schema to then being able to generate a
>>>>>> XML file that would look like this:
>>>>>>
>>>>>> <root>
>>>>>>
>>>>>> <process>
>>>>>> <input>
>>>>>> <data>blah</data>
>>>>>> </input>
>>>>>>
>>>>>> <output>
>>>>>> <data>bloh</data>
>>>>>> </output>
>>>>>>
>>>>>>
>>>>>> <process>
>>>>>> <output>
>>>>>> <data>blah</data>
>>>>>> </output>
>>>>>> </process>
>>>>>> </process>
>>>>>>
>>>>>>
>>>>>>
>>>>>> </root>
>>>>>>
>>>>>> As you can see, a <process> produces <output>s, uses <input>, and
>>>>>> can contain itself. My question is, how can we render, in XSD, the
>>>>>> fact that a <data> can be reused in two different objects?
>>>>>>
>>>>>> Cheers -
>>>>>
Re: Embedded elements [message #597936 is a reply to message #67628] Tue, 11 April 2006 11:25 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030201060208070309030806
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Guillaume,

Your own example below is an example, i.e., process is a local element
that uses a globally defined type.

<xsd:element name="processGroup" type="proc:processGroup"/>

<xsd:element name="dataId" type="xsd:string"/>

<xsd:complexType name="processGroup">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
* <xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
type="proc:process"/> *
</xsd:sequence>


Guillaume Windels wrote:
> Ed,
>
> "That's where having local element declarations of some shared global
> type should help you..."
>
> Would you mind illustrating that?
>
>
>
> Ed Merks a


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Embedded elements [message #597939 is a reply to message #67651] Tue, 11 April 2006 11:28 Go to previous message
Guillaume Windels is currently offline Guillaume WindelsFriend
Messages: 29
Registered: July 2009
Junior Member
Thanks Ed, it makes sense now!

Ed Merks a écrit :
> Guillaume,
>
> Your own example below is an example, i.e., process is a local element
> that uses a globally defined type.
>
> <xsd:element name="processGroup" type="proc:processGroup"/>
>
> <xsd:element name="dataId" type="xsd:string"/>
>
> <xsd:complexType name="processGroup">
> <xsd:sequence>
> <xsd:element name="name" type="xsd:string"/>
> * <xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
> type="proc:process"/> *
> </xsd:sequence>
>
>
> Guillaume Windels wrote:
>> Ed,
>>
>> "That's where having local element declarations of some shared global
>> type should help you..."
>>
>> Would you mind illustrating that?
>>
>>
>>
>> Ed Merks a écrit :
>>> Guillaume,
>>>
>>> Comments below.
>>>
>>> Guillaume Windels wrote:
>>>> That's fair enough.
>>>>
>>>> However, defining a global element seems to mix up with the root
>>>> element.
>>> Root element is not a term that has meaning in the XML Schema
>>> specification.
>>>> How can you tell you schema that a global element should not have
>>>> such behaviour?
>>> Since it doesn't mean anything to an XML Schema, you can't preclude
>>> such behavior. As such, if you only want to have a single global
>>> element declaration to represent the one and only valid root element
>>> of a document, you'll need to avoid global element declarations for
>>> all other cases. That's where having local element declarations of
>>> some shared global type should help you...
>>>>
>>>> Let me clarify that.
>>>>
>>>> This is the start of my XML Schema:
>>>> <xsd:element name="processGroup" type="proc:processGroup"/>
>>>>
>>>> <xsd:element name="dataId" type="xsd:string"/>
>>>>
>>>> <xsd:complexType name="processGroup">
>>>> <xsd:sequence>
>>>> <xsd:element name="name" type="xsd:string"/>
>>>> <xsd:element name="process" minOccurs="1" maxOccurs="unbounded"
>>>> type="proc:process"/>
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>>
>>>> ...
>>>>
>>>> ----------------------------------------
>>>>
>>>> In the schema, <dataId> stands for <data> (as discussed earlier).
>>>>
>>>> Take a look at the following screenshot:
>>>> http://img84.imageshack.us/img84/5367/dataid8lp.jpg
>>>>
>>>> ProcessModel1 is the DocumentRoot. How could you explain there is a
>>>> link between ProcessModel1 and dataId?
>>>>
>>>> Ed Merks a écrit :
>>>>> Guillaume,
>>>>>
>>>>> A global element can be referenced anywhere. A different approach
>>>>> is to define global types and to reuse those. I.e., each
>>>>> occurrence of <data> could be specified with a different local
>>>>> element declaration that references the same globally defined type.
>>>>>
>>>>>
>>>>> Guillaume Windels wrote:
>>>>>> Thanks Ed.
>>>>>>
>>>>>> Using a global element, would I still be able to add a reference
>>>>>> to it since a <data> element is used by both <input> and <output>?
>>>>>>
>>>>>> Ed Merks a écrit :
>>>>>>> Guillaume,
>>>>>>>
>>>>>>> Define it as a global element and use <element ref="..."/> to
>>>>>>> refer to it in multiple complex types.
>>>>>>>
>>>>>>>
>>>>>>> Guillaume Windels wrote:
>>>>>>>
>>>>>>>> I am trying to build a XML Schema to then being able to generate
>>>>>>>> a XML file that would look like this:
>>>>>>>>
>>>>>>>> <root>
>>>>>>>>
>>>>>>>> <process>
>>>>>>>> <input>
>>>>>>>> <data>blah</data>
>>>>>>>> </input>
>>>>>>>>
>>>>>>>> <output>
>>>>>>>> <data>bloh</data>
>>>>>>>> </output>
>>>>>>>>
>>>>>>>>
>>>>>>>> <process>
>>>>>>>> <output>
>>>>>>>> <data>blah</data>
>>>>>>>> </output>
>>>>>>>> </process>
>>>>>>>> </process>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> </root>
>>>>>>>>
>>>>>>>> As you can see, a <process> produces <output>s, uses <input>,
>>>>>>>> and can contain itself. My question is, how can we render, in
>>>>>>>> XSD, the fact that a <data> can be reused in two different objects?
>>>>>>>>
>>>>>>>> Cheers -
>>>>>>>
>
Previous Topic:Embedded elements
Next Topic:graphics export
Goto Forum:
  


Current Time: Fri Apr 19 03:42:23 GMT 2024

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

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

Back to the top