Home » Archived » XML Schema Definition (XSD) » How to Create xml schema with any number of subelement(0-n) and in any order
How to Create xml schema with any number of subelement(0-n) and in any order [message #50055] |
Wed, 11 August 2004 13:29  |
Eclipse User |
|
|
|
Originally posted by: susil.bravobrava.com
Hi All,
Seems like it did not post correctly first time. Anyway this is my first
post to this board.
----
I am working in an existing xml that has the following syntax:
1. element "actions" can have following elements more than once or not
at all:
: Sub elements "record", "say", "listen", "play","explain" as in xml
sample below
2. These sub elements could be in any order
Initially I thought of using "all" but it does not allow more than one
itration.
What could be the xml schema definition for this scenario?
Any help will be highly appreciated.
Thanks
Su
--------- Sample XML ------------------------------
Sample Xml:
<?xml version="1.0" encoding="utf-8"?>
<historySubmit sessionId="17A5C33539093BEB3B74E0FEEE476240" Version="1.0">
<sessions storyId="B5BB0DCB31F10C31E4DCC88ECF30F4EB" version="1.0">
<session start="2004-08-09 16:22:01" duration="00:03:21.122">
<properties>
<type>PRACTICE</type>
<software>SpeaK!</software>
</properties>
<actions>
<record start="00:00:10.083" wordId="0"
filename="20040809_162211.spx">
<w id="0" start="0" duration="540" result="MEDIUM" />
<w id="1" start="540" duration="440" result="FORCED" />
</record>
<record start="00:00:12.281" wordId="2"
filename="20040809_162213.spx" auto="True">
<w id="2" start="0" duration="580" result="BAD" />
<w id="3" start="580" duration="480" result="BAD" />
<w id="4" start="1230" duration="910" result="MEDIUM" />
<w id="5" start="2470" duration="210" result="FORCED" />
<w id="6" start="2680" duration="500" result="MEDIUM" />
<w id="7" start="3850" duration="370" result="MEDIUM" />
<w id="8" start="4340" duration="520" result="GOOD" />
<w id="9" start="4890" duration="370" result="BAD" />
<w id="10" start="5260" duration="210" result="FORCED" />
<w id="11" start="5470" duration="260" result="MEDIUM" />
<w id="11" start="5980" duration="330" result="MEDIUM" />
<w id="12" start="7340" duration="600" result="BAD" />
<w id="13" start="8530" duration="450" result="FORCED" />
</record>
<record start="00:00:22.130" wordId="14"
filename="20040809_162223.spx" auto="True">
<w id="14" start="0" duration="500" result="FORCED" />
</record>
<record start="00:00:24.141" wordId="15"
filename="20040809_162225.spx" auto="True">
<w id="15" start="0" duration="1020" result="MEDIUM" />
<w id="16" start="1020" duration="610" result="MEDIUM" />
<w id="17" start="1670" duration="450" result="MEDIUM" />
<w id="18" start="2480" duration="360" result="MEDIUM" />
<w id="19" start="2840" duration="410" result="MEDIUM" />
<w id="20" start="3250" duration="160" result="GOOD" />
<w id="21" start="3510" duration="190" result="FORCED" />
<w id="22" start="3700" duration="280" result="GOOD" />
<w id="23" start="4010" duration="480" result="MEDIUM" />
</record>
<play start="00:00:31.154" startId="24" stopId="26" />
<say start="00:00:33.601" wordId="36" />
<say start="00:00:34.629" wordId="37" />
<explain start="00:00:35.596" wordId="37" />
<play start="00:00:36.671" startId="37" stopId="40" />
<record start="00:00:40.069" wordId="40"
filename="20040809_162241.spx">
<w id="40" start="0" duration="970" result="MEDIUM" />
</record>
</actions>
</session>
<session start="2004-08-09 16:31:12" duration="00:00:19.872">
<properties>
<type>PRACTICE</type>
<software>SpeaK!</software>
</properties>
</session>
<session start="2004-08-09 16:41:52" duration="00:00:27.915">
<properties>
<type>PRACTICE</type>
<software>SpeaK!</software>
</properties>
<actions>
<record start="00:00:23.364" wordId="37"
filename="20040809_164216.spx" />
<say start="00:00:25.702" wordId="37" />
</actions>
</session>
</sessions>
</historySubmit>
|
|
| |
Re: How to Create xml schema with any number of subelement(0-n) and in any order [message #50157 is a reply to message #50116] |
Wed, 11 August 2004 14:15   |
Eclipse User |
|
|
|
Originally posted by: susil.bravobrava.com
Ed Merks wrote:
> Su,
>
> As in the previous append, <choice> with minOccurs="0" and
> maxOccurs="unbounded" of the subelements will validate any combination
> of zero or more subelements.
>
> exquisitus wrote:
>
>> Hi All,
>>
>> Seems like it did not post correctly first time. Anyway this is my
>> first post to this board.
>>
>> ----
>> I am working in an existing xml that has the following syntax:
>>
>> 1. element "actions" can have following elements more than once or not
>> at all:
>> : Sub elements "record", "say", "listen", "play","explain" as in xml
>> sample below
>> 2. These sub elements could be in any order
>>
>> Initially I thought of using "all" but it does not allow more than one
>> itration.
>>
>> What could be the xml schema definition for this scenario?
>>
>> Any help will be highly appreciated.
>>
>> Thanks
>> Su
>>
>> --------- Sample XML ------------------------------
>> Sample Xml:
>> <?xml version="1.0" encoding="utf-8"?>
>> <historySubmit sessionId="17A5C33539093BEB3B74E0FEEE476240"
>> Version="1.0">
>> <sessions storyId="B5BB0DCB31F10C31E4DCC88ECF30F4EB" version="1.0">
>> <session start="2004-08-09 16:22:01" duration="00:03:21.122">
>> <properties>
>> <type>PRACTICE</type>
>> <software>SpeaK!</software>
>> </properties>
>> <actions>
>> <record start="00:00:10.083" wordId="0"
>> filename="20040809_162211.spx">
>> <w id="0" start="0" duration="540" result="MEDIUM" />
>> <w id="1" start="540" duration="440" result="FORCED" />
>> </record>
>> <record start="00:00:12.281" wordId="2"
>> filename="20040809_162213.spx" auto="True">
>> <w id="2" start="0" duration="580" result="BAD" />
>> <w id="3" start="580" duration="480" result="BAD" />
>> <w id="4" start="1230" duration="910" result="MEDIUM" />
>> <w id="5" start="2470" duration="210" result="FORCED" />
>> <w id="6" start="2680" duration="500" result="MEDIUM" />
>> <w id="7" start="3850" duration="370" result="MEDIUM" />
>> <w id="8" start="4340" duration="520" result="GOOD" />
>> <w id="9" start="4890" duration="370" result="BAD" />
>> <w id="10" start="5260" duration="210" result="FORCED" />
>> <w id="11" start="5470" duration="260" result="MEDIUM" />
>> <w id="11" start="5980" duration="330" result="MEDIUM" />
>> <w id="12" start="7340" duration="600" result="BAD" />
>> <w id="13" start="8530" duration="450" result="FORCED" />
>> </record>
>> <record start="00:00:22.130" wordId="14"
>> filename="20040809_162223.spx" auto="True">
>> <w id="14" start="0" duration="500" result="FORCED" />
>> </record>
>> <record start="00:00:24.141" wordId="15"
>> filename="20040809_162225.spx" auto="True">
>> <w id="15" start="0" duration="1020" result="MEDIUM" />
>> <w id="16" start="1020" duration="610" result="MEDIUM" />
>> <w id="17" start="1670" duration="450" result="MEDIUM" />
>> <w id="18" start="2480" duration="360" result="MEDIUM" />
>> <w id="19" start="2840" duration="410" result="MEDIUM" />
>> <w id="20" start="3250" duration="160" result="GOOD" />
>> <w id="21" start="3510" duration="190" result="FORCED" />
>> <w id="22" start="3700" duration="280" result="GOOD" />
>> <w id="23" start="4010" duration="480" result="MEDIUM" />
>> </record>
>> <play start="00:00:31.154" startId="24" stopId="26" />
>> <say start="00:00:33.601" wordId="36" />
>> <say start="00:00:34.629" wordId="37" />
>> <explain start="00:00:35.596" wordId="37" />
>> <play start="00:00:36.671" startId="37" stopId="40" />
>> <record start="00:00:40.069" wordId="40"
>> filename="20040809_162241.spx">
>> <w id="40" start="0" duration="970" result="MEDIUM" />
>> </record>
>> </actions>
>> </session>
>> <session start="2004-08-09 16:31:12" duration="00:00:19.872">
>> <properties>
>> <type>PRACTICE</type>
>> <software>SpeaK!</software>
>> </properties>
>> </session>
>> <session start="2004-08-09 16:41:52" duration="00:00:27.915">
>> <properties>
>> <type>PRACTICE</type>
>> <software>SpeaK!</software>
>> </properties>
>> <actions>
>> <record start="00:00:23.364" wordId="37"
>> filename="20040809_164216.spx" />
>> <say start="00:00:25.702" wordId="37" />
>> </actions>
>> </session>
>> </sessions>
>> </historySubmit>
>>
>>
Thanks for suggestion Merks, I tried that before and got error during
validation/or did not see the data at all. The reason being these sub
elements
("record", "say", "listen", "play","explain") could occur in any
combination and each of this element can occur in any number of times
within "action" element.
I might not have mentioned this contraints in my last thread clearly.
Thanks
Susil
ie; something like this:
<action>
<record></record>
<record></record>
<play></play>
<listen></listen>
<say></say>
<explain></explain>
<explain></explain>
</action>
<action>
<play></play>
<record></record>
<listen></listen>
<explain></explain>
<explain></explain>
<say></say>
</action>
<action>
<play></play>
<say></say>
</action>
<action>
<record></record>
<record></record>
<record></record>
</action>
<action>
<explain></explain>
<explain></explain>
<record></record>
<record></record>
<play></play>
<play></play>
<play></play>
<listen></listen>
<say></say>
<say></say>
</action>
<action>
<explain></explain>
<explain></explain>
<record></record>
</action>
<action>
<say></say>
<say></say>
<say></say>
</action>
|
|
|
Re: How to Create xml schema with any number of subelement(0-n) and in any order [message #50181 is a reply to message #50157] |
Wed, 11 August 2004 14:25   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Susil,
A repeating choice will allow you to make a different choice or the same
choice each time, so you can literally have any combination of an
abtirary number of subelements. I get the feeling now that you don't
want just any combination, but rather if a given subelement occurrs more
than once, all the occurrences must be adjancent. The only way to
expess that, I think, would be as a choice of each possible ordering
and by putting the min/maxOccurs on each element. I.e., like (A*B* |
B*A*)....
exquisitus wrote:
> Ed Merks wrote:
>
>> Su,
>>
>> As in the previous append, <choice> with minOccurs="0" and
>> maxOccurs="unbounded" of the subelements will validate any
>> combination of zero or more subelements.
>>
>> exquisitus wrote:
>>
>>> Hi All,
>>>
>>> Seems like it did not post correctly first time. Anyway this is my
>>> first post to this board.
>>>
>>> ----
>>> I am working in an existing xml that has the following syntax:
>>>
>>> 1. element "actions" can have following elements more than once or
>>> not at all:
>>> : Sub elements "record", "say", "listen", "play","explain" as in xml
>>> sample below
>>> 2. These sub elements could be in any order
>>>
>>> Initially I thought of using "all" but it does not allow more than
>>> one itration.
>>>
>>> What could be the xml schema definition for this scenario?
>>>
>>> Any help will be highly appreciated.
>>>
>>> Thanks
>>> Su
>>>
>>> --------- Sample XML ------------------------------
>>> Sample Xml:
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <historySubmit sessionId="17A5C33539093BEB3B74E0FEEE476240"
>>> Version="1.0">
>>> <sessions storyId="B5BB0DCB31F10C31E4DCC88ECF30F4EB" version="1.0">
>>> <session start="2004-08-09 16:22:01" duration="00:03:21.122">
>>> <properties>
>>> <type>PRACTICE</type>
>>> <software>SpeaK!</software>
>>> </properties>
>>> <actions>
>>> <record start="00:00:10.083" wordId="0"
>>> filename="20040809_162211.spx">
>>> <w id="0" start="0" duration="540" result="MEDIUM" />
>>> <w id="1" start="540" duration="440" result="FORCED" />
>>> </record>
>>> <record start="00:00:12.281" wordId="2"
>>> filename="20040809_162213.spx" auto="True">
>>> <w id="2" start="0" duration="580" result="BAD" />
>>> <w id="3" start="580" duration="480" result="BAD" />
>>> <w id="4" start="1230" duration="910" result="MEDIUM" />
>>> <w id="5" start="2470" duration="210" result="FORCED" />
>>> <w id="6" start="2680" duration="500" result="MEDIUM" />
>>> <w id="7" start="3850" duration="370" result="MEDIUM" />
>>> <w id="8" start="4340" duration="520" result="GOOD" />
>>> <w id="9" start="4890" duration="370" result="BAD" />
>>> <w id="10" start="5260" duration="210" result="FORCED" />
>>> <w id="11" start="5470" duration="260" result="MEDIUM" />
>>> <w id="11" start="5980" duration="330" result="MEDIUM" />
>>> <w id="12" start="7340" duration="600" result="BAD" />
>>> <w id="13" start="8530" duration="450" result="FORCED" />
>>> </record>
>>> <record start="00:00:22.130" wordId="14"
>>> filename="20040809_162223.spx" auto="True">
>>> <w id="14" start="0" duration="500" result="FORCED" />
>>> </record>
>>> <record start="00:00:24.141" wordId="15"
>>> filename="20040809_162225.spx" auto="True">
>>> <w id="15" start="0" duration="1020" result="MEDIUM" />
>>> <w id="16" start="1020" duration="610" result="MEDIUM" />
>>> <w id="17" start="1670" duration="450" result="MEDIUM" />
>>> <w id="18" start="2480" duration="360" result="MEDIUM" />
>>> <w id="19" start="2840" duration="410" result="MEDIUM" />
>>> <w id="20" start="3250" duration="160" result="GOOD" />
>>> <w id="21" start="3510" duration="190" result="FORCED" />
>>> <w id="22" start="3700" duration="280" result="GOOD" />
>>> <w id="23" start="4010" duration="480" result="MEDIUM" />
>>> </record>
>>> <play start="00:00:31.154" startId="24" stopId="26" />
>>> <say start="00:00:33.601" wordId="36" />
>>> <say start="00:00:34.629" wordId="37" />
>>> <explain start="00:00:35.596" wordId="37" />
>>> <play start="00:00:36.671" startId="37" stopId="40" />
>>> <record start="00:00:40.069" wordId="40"
>>> filename="20040809_162241.spx">
>>> <w id="40" start="0" duration="970" result="MEDIUM" />
>>> </record>
>>> </actions>
>>> </session>
>>> <session start="2004-08-09 16:31:12" duration="00:00:19.872">
>>> <properties>
>>> <type>PRACTICE</type>
>>> <software>SpeaK!</software>
>>> </properties>
>>> </session>
>>> <session start="2004-08-09 16:41:52" duration="00:00:27.915">
>>> <properties>
>>> <type>PRACTICE</type>
>>> <software>SpeaK!</software>
>>> </properties>
>>> <actions>
>>> <record start="00:00:23.364" wordId="37"
>>> filename="20040809_164216.spx" />
>>> <say start="00:00:25.702" wordId="37" />
>>> </actions>
>>> </session>
>>> </sessions>
>>> </historySubmit>
>>>
>>>
> Thanks for suggestion Merks, I tried that before and got error during
> validation/or did not see the data at all. The reason being these sub
> elements
> ("record", "say", "listen", "play","explain") could occur in any
> combination and each of this element can occur in any number of times
> within "action" element.
>
> I might not have mentioned this contraints in my last thread clearly.
>
> Thanks
> Susil
>
> ie; something like this:
> <action>
> <record></record>
> <record></record>
> <play></play>
> <listen></listen>
> <say></say>
> <explain></explain>
> <explain></explain>
> </action>
> <action>
> <play></play>
> <record></record>
> <listen></listen>
> <explain></explain>
> <explain></explain>
> <say></say>
> </action>
> <action>
> <play></play>
> <say></say>
> </action>
> <action>
> <record></record>
> <record></record>
> <record></record>
> </action>
> <action>
> <explain></explain>
> <explain></explain>
> <record></record>
> <record></record>
> <play></play>
> <play></play>
> <play></play>
> <listen></listen>
> <say></say>
> <say></say>
> </action>
> <action>
> <explain></explain>
> <explain></explain>
> <record></record>
> </action>
> <action>
> <say></say>
> <say></say>
> <say></say>
> </action>
>
|
|
|
Re: How to Create xml schema with any number of subelement(0-n) and in any order [message #51564 is a reply to message #50181] |
Tue, 24 August 2004 17:37  |
Eclipse User |
|
|
|
Originally posted by: susil.bravobrava.com
Ed Merks wrote:
> Susil,
>
> A repeating choice will allow you to make a different choice or the same
> choice each time, so you can literally have any combination of an
> abtirary number of subelements. I get the feeling now that you don't
> want just any combination, but rather if a given subelement occurrs more
> than once, all the occurrences must be adjancent. The only way to
> expess that, I think, would be as a choice of each possible ordering
> and by putting the min/maxOccurs on each element. I.e., like (A*B* |
> B*A*)....
>
>
> exquisitus wrote:
>
>> Ed Merks wrote:
>>
>>> Su,
>>>
>>> As in the previous append, <choice> with minOccurs="0" and
>>> maxOccurs="unbounded" of the subelements will validate any
>>> combination of zero or more subelements.
>>>
>>> exquisitus wrote:
>>>
>>>> Hi All,
>>>>
>>>> Seems like it did not post correctly first time. Anyway this is my
>>>> first post to this board.
>>>>
>>>> ----
>>>> I am working in an existing xml that has the following syntax:
>>>>
>>>> 1. element "actions" can have following elements more than once or
>>>> not at all:
>>>> : Sub elements "record", "say", "listen", "play","explain" as in xml
>>>> sample below
>>>> 2. These sub elements could be in any order
>>>>
>>>> Initially I thought of using "all" but it does not allow more than
>>>> one itration.
>>>>
>>>> What could be the xml schema definition for this scenario?
>>>>
>>>> Any help will be highly appreciated.
>>>>
>>>> Thanks
>>>> Su
>>>>
>>>> --------- Sample XML ------------------------------
>>>> Sample Xml:
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <historySubmit sessionId="17A5C33539093BEB3B74E0FEEE476240"
>>>> Version="1.0">
>>>> <sessions storyId="B5BB0DCB31F10C31E4DCC88ECF30F4EB" version="1.0">
>>>> <session start="2004-08-09 16:22:01" duration="00:03:21.122">
>>>> <properties>
>>>> <type>PRACTICE</type>
>>>> <software>SpeaK!</software>
>>>> </properties>
>>>> <actions>
>>>> <record start="00:00:10.083" wordId="0"
>>>> filename="20040809_162211.spx">
>>>> <w id="0" start="0" duration="540" result="MEDIUM" />
>>>> <w id="1" start="540" duration="440" result="FORCED" />
>>>> </record>
>>>> <record start="00:00:12.281" wordId="2"
>>>> filename="20040809_162213.spx" auto="True">
>>>> <w id="2" start="0" duration="580" result="BAD" />
>>>> <w id="3" start="580" duration="480" result="BAD" />
>>>> <w id="4" start="1230" duration="910" result="MEDIUM" />
>>>> <w id="5" start="2470" duration="210" result="FORCED" />
>>>> <w id="6" start="2680" duration="500" result="MEDIUM" />
>>>> <w id="7" start="3850" duration="370" result="MEDIUM" />
>>>> <w id="8" start="4340" duration="520" result="GOOD" />
>>>> <w id="9" start="4890" duration="370" result="BAD" />
>>>> <w id="10" start="5260" duration="210" result="FORCED" />
>>>> <w id="11" start="5470" duration="260" result="MEDIUM" />
>>>> <w id="11" start="5980" duration="330" result="MEDIUM" />
>>>> <w id="12" start="7340" duration="600" result="BAD" />
>>>> <w id="13" start="8530" duration="450" result="FORCED" />
>>>> </record>
>>>> <record start="00:00:22.130" wordId="14"
>>>> filename="20040809_162223.spx" auto="True">
>>>> <w id="14" start="0" duration="500" result="FORCED" />
>>>> </record>
>>>> <record start="00:00:24.141" wordId="15"
>>>> filename="20040809_162225.spx" auto="True">
>>>> <w id="15" start="0" duration="1020" result="MEDIUM" />
>>>> <w id="16" start="1020" duration="610" result="MEDIUM" />
>>>> <w id="17" start="1670" duration="450" result="MEDIUM" />
>>>> <w id="18" start="2480" duration="360" result="MEDIUM" />
>>>> <w id="19" start="2840" duration="410" result="MEDIUM" />
>>>> <w id="20" start="3250" duration="160" result="GOOD" />
>>>> <w id="21" start="3510" duration="190" result="FORCED" />
>>>> <w id="22" start="3700" duration="280" result="GOOD" />
>>>> <w id="23" start="4010" duration="480" result="MEDIUM" />
>>>> </record>
>>>> <play start="00:00:31.154" startId="24" stopId="26" />
>>>> <say start="00:00:33.601" wordId="36" />
>>>> <say start="00:00:34.629" wordId="37" />
>>>> <explain start="00:00:35.596" wordId="37" />
>>>> <play start="00:00:36.671" startId="37" stopId="40" />
>>>> <record start="00:00:40.069" wordId="40"
>>>> filename="20040809_162241.spx">
>>>> <w id="40" start="0" duration="970" result="MEDIUM" />
>>>> </record>
>>>> </actions>
>>>> </session>
>>>> <session start="2004-08-09 16:31:12" duration="00:00:19.872">
>>>> <properties>
>>>> <type>PRACTICE</type>
>>>> <software>SpeaK!</software>
>>>> </properties>
>>>> </session>
>>>> <session start="2004-08-09 16:41:52" duration="00:00:27.915">
>>>> <properties>
>>>> <type>PRACTICE</type>
>>>> <software>SpeaK!</software>
>>>> </properties>
>>>> <actions>
>>>> <record start="00:00:23.364" wordId="37"
>>>> filename="20040809_164216.spx" />
>>>> <say start="00:00:25.702" wordId="37" />
>>>> </actions>
>>>> </session>
>>>> </sessions>
>>>> </historySubmit>
>>>>
>>>>
>> Thanks for suggestion Merks, I tried that before and got error during
>> validation/or did not see the data at all. The reason being these sub
>> elements
>> ("record", "say", "listen", "play","explain") could occur in any
>> combination and each of this element can occur in any number of times
>> within "action" element.
>>
>> I might not have mentioned this contraints in my last thread clearly.
>>
>> Thanks
>> Susil
>>
>> ie; something like this:
>> <action>
>> <record></record>
>> <record></record>
>> <play></play>
>> <listen></listen>
>> <say></say>
>> <explain></explain>
>> <explain></explain>
>> </action>
>> <action>
>> <play></play>
>> <record></record>
>> <listen></listen>
>> <explain></explain>
>> <explain></explain>
>> <say></say>
>> </action>
>> <action>
>> <play></play>
>> <say></say>
>> </action>
>> <action>
>> <record></record>
>> <record></record>
>> <record></record>
>> </action>
>> <action>
>> <explain></explain>
>> <explain></explain>
>> <record></record>
>> <record></record>
>> <play></play>
>> <play></play>
>> <play></play>
>> <listen></listen>
>> <say></say>
>> <say></say>
>> </action>
>> <action>
>> <explain></explain>
>> <explain></explain>
>> <record></record>
>> </action>
>> <action>
>> <say></say>
>> <say></say>
>> <say></say>
>> </action>
>>
Thanks ED,
It working now. I was using it along with JAXB. The java object that was
created by JAXB names it in such a that it just pick first three
element( although it is able to retrun other element list)
Susil
|
|
|
Re: How to Create xml schema with any number of subelement(0-n) and in any order [message #590115 is a reply to message #50055] |
Wed, 11 August 2004 13:38  |
Eclipse User |
|
|
|
Su,
As in the previous append, <choice> with minOccurs="0" and
maxOccurs="unbounded" of the subelements will validate any combination
of zero or more subelements.
exquisitus wrote:
> Hi All,
>
> Seems like it did not post correctly first time. Anyway this is my
> first post to this board.
>
> ----
> I am working in an existing xml that has the following syntax:
>
> 1. element "actions" can have following elements more than once or not
> at all:
> : Sub elements "record", "say", "listen", "play","explain" as in xml
> sample below
> 2. These sub elements could be in any order
>
> Initially I thought of using "all" but it does not allow more than one
> itration.
>
> What could be the xml schema definition for this scenario?
>
> Any help will be highly appreciated.
>
> Thanks
> Su
>
> --------- Sample XML ------------------------------
> Sample Xml:
> <?xml version="1.0" encoding="utf-8"?>
> <historySubmit sessionId="17A5C33539093BEB3B74E0FEEE476240"
> Version="1.0">
> <sessions storyId="B5BB0DCB31F10C31E4DCC88ECF30F4EB" version="1.0">
> <session start="2004-08-09 16:22:01" duration="00:03:21.122">
> <properties>
> <type>PRACTICE</type>
> <software>SpeaK!</software>
> </properties>
> <actions>
> <record start="00:00:10.083" wordId="0"
> filename="20040809_162211.spx">
> <w id="0" start="0" duration="540" result="MEDIUM" />
> <w id="1" start="540" duration="440" result="FORCED" />
> </record>
> <record start="00:00:12.281" wordId="2"
> filename="20040809_162213.spx" auto="True">
> <w id="2" start="0" duration="580" result="BAD" />
> <w id="3" start="580" duration="480" result="BAD" />
> <w id="4" start="1230" duration="910" result="MEDIUM" />
> <w id="5" start="2470" duration="210" result="FORCED" />
> <w id="6" start="2680" duration="500" result="MEDIUM" />
> <w id="7" start="3850" duration="370" result="MEDIUM" />
> <w id="8" start="4340" duration="520" result="GOOD" />
> <w id="9" start="4890" duration="370" result="BAD" />
> <w id="10" start="5260" duration="210" result="FORCED" />
> <w id="11" start="5470" duration="260" result="MEDIUM" />
> <w id="11" start="5980" duration="330" result="MEDIUM" />
> <w id="12" start="7340" duration="600" result="BAD" />
> <w id="13" start="8530" duration="450" result="FORCED" />
> </record>
> <record start="00:00:22.130" wordId="14"
> filename="20040809_162223.spx" auto="True">
> <w id="14" start="0" duration="500" result="FORCED" />
> </record>
> <record start="00:00:24.141" wordId="15"
> filename="20040809_162225.spx" auto="True">
> <w id="15" start="0" duration="1020" result="MEDIUM" />
> <w id="16" start="1020" duration="610" result="MEDIUM" />
> <w id="17" start="1670" duration="450" result="MEDIUM" />
> <w id="18" start="2480" duration="360" result="MEDIUM" />
> <w id="19" start="2840" duration="410" result="MEDIUM" />
> <w id="20" start="3250" duration="160" result="GOOD" />
> <w id="21" start="3510" duration="190" result="FORCED" />
> <w id="22" start="3700" duration="280" result="GOOD" />
> <w id="23" start="4010" duration="480" result="MEDIUM" />
> </record>
> <play start="00:00:31.154" startId="24" stopId="26" />
> <say start="00:00:33.601" wordId="36" />
> <say start="00:00:34.629" wordId="37" />
> <explain start="00:00:35.596" wordId="37" />
> <play start="00:00:36.671" startId="37" stopId="40" />
> <record start="00:00:40.069" wordId="40"
> filename="20040809_162241.spx">
> <w id="40" start="0" duration="970" result="MEDIUM" />
> </record>
> </actions>
> </session>
> <session start="2004-08-09 16:31:12" duration="00:00:19.872">
> <properties>
> <type>PRACTICE</type>
> <software>SpeaK!</software>
> </properties>
> </session>
> <session start="2004-08-09 16:41:52" duration="00:00:27.915">
> <properties>
> <type>PRACTICE</type>
> <software>SpeaK!</software>
> </properties>
> <actions>
> <record start="00:00:23.364" wordId="37"
> filename="20040809_164216.spx" />
> <say start="00:00:25.702" wordId="37" />
> </actions>
> </session>
> </sessions>
> </historySubmit>
>
>
|
|
|
Re: How to Create xml schema with any number of subelement(0-n) and in any order [message #590133 is a reply to message #50116] |
Wed, 11 August 2004 14:15  |
Eclipse User |
|
|
|
Ed Merks wrote:
> Su,
>
> As in the previous append, <choice> with minOccurs="0" and
> maxOccurs="unbounded" of the subelements will validate any combination
> of zero or more subelements.
>
> exquisitus wrote:
>
>> Hi All,
>>
>> Seems like it did not post correctly first time. Anyway this is my
>> first post to this board.
>>
>> ----
>> I am working in an existing xml that has the following syntax:
>>
>> 1. element "actions" can have following elements more than once or not
>> at all:
>> : Sub elements "record", "say", "listen", "play","explain" as in xml
>> sample below
>> 2. These sub elements could be in any order
>>
>> Initially I thought of using "all" but it does not allow more than one
>> itration.
>>
>> What could be the xml schema definition for this scenario?
>>
>> Any help will be highly appreciated.
>>
>> Thanks
>> Su
>>
>> --------- Sample XML ------------------------------
>> Sample Xml:
>> <?xml version="1.0" encoding="utf-8"?>
>> <historySubmit sessionId="17A5C33539093BEB3B74E0FEEE476240"
>> Version="1.0">
>> <sessions storyId="B5BB0DCB31F10C31E4DCC88ECF30F4EB" version="1.0">
>> <session start="2004-08-09 16:22:01" duration="00:03:21.122">
>> <properties>
>> <type>PRACTICE</type>
>> <software>SpeaK!</software>
>> </properties>
>> <actions>
>> <record start="00:00:10.083" wordId="0"
>> filename="20040809_162211.spx">
>> <w id="0" start="0" duration="540" result="MEDIUM" />
>> <w id="1" start="540" duration="440" result="FORCED" />
>> </record>
>> <record start="00:00:12.281" wordId="2"
>> filename="20040809_162213.spx" auto="True">
>> <w id="2" start="0" duration="580" result="BAD" />
>> <w id="3" start="580" duration="480" result="BAD" />
>> <w id="4" start="1230" duration="910" result="MEDIUM" />
>> <w id="5" start="2470" duration="210" result="FORCED" />
>> <w id="6" start="2680" duration="500" result="MEDIUM" />
>> <w id="7" start="3850" duration="370" result="MEDIUM" />
>> <w id="8" start="4340" duration="520" result="GOOD" />
>> <w id="9" start="4890" duration="370" result="BAD" />
>> <w id="10" start="5260" duration="210" result="FORCED" />
>> <w id="11" start="5470" duration="260" result="MEDIUM" />
>> <w id="11" start="5980" duration="330" result="MEDIUM" />
>> <w id="12" start="7340" duration="600" result="BAD" />
>> <w id="13" start="8530" duration="450" result="FORCED" />
>> </record>
>> <record start="00:00:22.130" wordId="14"
>> filename="20040809_162223.spx" auto="True">
>> <w id="14" start="0" duration="500" result="FORCED" />
>> </record>
>> <record start="00:00:24.141" wordId="15"
>> filename="20040809_162225.spx" auto="True">
>> <w id="15" start="0" duration="1020" result="MEDIUM" />
>> <w id="16" start="1020" duration="610" result="MEDIUM" />
>> <w id="17" start="1670" duration="450" result="MEDIUM" />
>> <w id="18" start="2480" duration="360" result="MEDIUM" />
>> <w id="19" start="2840" duration="410" result="MEDIUM" />
>> <w id="20" start="3250" duration="160" result="GOOD" />
>> <w id="21" start="3510" duration="190" result="FORCED" />
>> <w id="22" start="3700" duration="280" result="GOOD" />
>> <w id="23" start="4010" duration="480" result="MEDIUM" />
>> </record>
>> <play start="00:00:31.154" startId="24" stopId="26" />
>> <say start="00:00:33.601" wordId="36" />
>> <say start="00:00:34.629" wordId="37" />
>> <explain start="00:00:35.596" wordId="37" />
>> <play start="00:00:36.671" startId="37" stopId="40" />
>> <record start="00:00:40.069" wordId="40"
>> filename="20040809_162241.spx">
>> <w id="40" start="0" duration="970" result="MEDIUM" />
>> </record>
>> </actions>
>> </session>
>> <session start="2004-08-09 16:31:12" duration="00:00:19.872">
>> <properties>
>> <type>PRACTICE</type>
>> <software>SpeaK!</software>
>> </properties>
>> </session>
>> <session start="2004-08-09 16:41:52" duration="00:00:27.915">
>> <properties>
>> <type>PRACTICE</type>
>> <software>SpeaK!</software>
>> </properties>
>> <actions>
>> <record start="00:00:23.364" wordId="37"
>> filename="20040809_164216.spx" />
>> <say start="00:00:25.702" wordId="37" />
>> </actions>
>> </session>
>> </sessions>
>> </historySubmit>
>>
>>
Thanks for suggestion Merks, I tried that before and got error during
validation/or did not see the data at all. The reason being these sub
elements
("record", "say", "listen", "play","explain") could occur in any
combination and each of this element can occur in any number of times
within "action" element.
I might not have mentioned this contraints in my last thread clearly.
Thanks
Susil
ie; something like this:
<action>
<record></record>
<record></record>
<play></play>
<listen></listen>
<say></say>
<explain></explain>
<explain></explain>
</action>
<action>
<play></play>
<record></record>
<listen></listen>
<explain></explain>
<explain></explain>
<say></say>
</action>
<action>
<play></play>
<say></say>
</action>
<action>
<record></record>
<record></record>
<record></record>
</action>
<action>
<explain></explain>
<explain></explain>
<record></record>
<record></record>
<play></play>
<play></play>
<play></play>
<listen></listen>
<say></say>
<say></say>
</action>
<action>
<explain></explain>
<explain></explain>
<record></record>
</action>
<action>
<say></say>
<say></say>
<say></say>
</action>
|
|
|
Re: How to Create xml schema with any number of subelement(0-n) and in any order [message #590146 is a reply to message #50157] |
Wed, 11 August 2004 14:25  |
Eclipse User |
|
|
|
Susil,
A repeating choice will allow you to make a different choice or the same
choice each time, so you can literally have any combination of an
abtirary number of subelements. I get the feeling now that you don't
want just any combination, but rather if a given subelement occurrs more
than once, all the occurrences must be adjancent. The only way to
expess that, I think, would be as a choice of each possible ordering
and by putting the min/maxOccurs on each element. I.e., like (A*B* |
B*A*)....
exquisitus wrote:
> Ed Merks wrote:
>
>> Su,
>>
>> As in the previous append, <choice> with minOccurs="0" and
>> maxOccurs="unbounded" of the subelements will validate any
>> combination of zero or more subelements.
>>
>> exquisitus wrote:
>>
>>> Hi All,
>>>
>>> Seems like it did not post correctly first time. Anyway this is my
>>> first post to this board.
>>>
>>> ----
>>> I am working in an existing xml that has the following syntax:
>>>
>>> 1. element "actions" can have following elements more than once or
>>> not at all:
>>> : Sub elements "record", "say", "listen", "play","explain" as in xml
>>> sample below
>>> 2. These sub elements could be in any order
>>>
>>> Initially I thought of using "all" but it does not allow more than
>>> one itration.
>>>
>>> What could be the xml schema definition for this scenario?
>>>
>>> Any help will be highly appreciated.
>>>
>>> Thanks
>>> Su
>>>
>>> --------- Sample XML ------------------------------
>>> Sample Xml:
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <historySubmit sessionId="17A5C33539093BEB3B74E0FEEE476240"
>>> Version="1.0">
>>> <sessions storyId="B5BB0DCB31F10C31E4DCC88ECF30F4EB" version="1.0">
>>> <session start="2004-08-09 16:22:01" duration="00:03:21.122">
>>> <properties>
>>> <type>PRACTICE</type>
>>> <software>SpeaK!</software>
>>> </properties>
>>> <actions>
>>> <record start="00:00:10.083" wordId="0"
>>> filename="20040809_162211.spx">
>>> <w id="0" start="0" duration="540" result="MEDIUM" />
>>> <w id="1" start="540" duration="440" result="FORCED" />
>>> </record>
>>> <record start="00:00:12.281" wordId="2"
>>> filename="20040809_162213.spx" auto="True">
>>> <w id="2" start="0" duration="580" result="BAD" />
>>> <w id="3" start="580" duration="480" result="BAD" />
>>> <w id="4" start="1230" duration="910" result="MEDIUM" />
>>> <w id="5" start="2470" duration="210" result="FORCED" />
>>> <w id="6" start="2680" duration="500" result="MEDIUM" />
>>> <w id="7" start="3850" duration="370" result="MEDIUM" />
>>> <w id="8" start="4340" duration="520" result="GOOD" />
>>> <w id="9" start="4890" duration="370" result="BAD" />
>>> <w id="10" start="5260" duration="210" result="FORCED" />
>>> <w id="11" start="5470" duration="260" result="MEDIUM" />
>>> <w id="11" start="5980" duration="330" result="MEDIUM" />
>>> <w id="12" start="7340" duration="600" result="BAD" />
>>> <w id="13" start="8530" duration="450" result="FORCED" />
>>> </record>
>>> <record start="00:00:22.130" wordId="14"
>>> filename="20040809_162223.spx" auto="True">
>>> <w id="14" start="0" duration="500" result="FORCED" />
>>> </record>
>>> <record start="00:00:24.141" wordId="15"
>>> filename="20040809_162225.spx" auto="True">
>>> <w id="15" start="0" duration="1020" result="MEDIUM" />
>>> <w id="16" start="1020" duration="610" result="MEDIUM" />
>>> <w id="17" start="1670" duration="450" result="MEDIUM" />
>>> <w id="18" start="2480" duration="360" result="MEDIUM" />
>>> <w id="19" start="2840" duration="410" result="MEDIUM" />
>>> <w id="20" start="3250" duration="160" result="GOOD" />
>>> <w id="21" start="3510" duration="190" result="FORCED" />
>>> <w id="22" start="3700" duration="280" result="GOOD" />
>>> <w id="23" start="4010" duration="480" result="MEDIUM" />
>>> </record>
>>> <play start="00:00:31.154" startId="24" stopId="26" />
>>> <say start="00:00:33.601" wordId="36" />
>>> <say start="00:00:34.629" wordId="37" />
>>> <explain start="00:00:35.596" wordId="37" />
>>> <play start="00:00:36.671" startId="37" stopId="40" />
>>> <record start="00:00:40.069" wordId="40"
>>> filename="20040809_162241.spx">
>>> <w id="40" start="0" duration="970" result="MEDIUM" />
>>> </record>
>>> </actions>
>>> </session>
>>> <session start="2004-08-09 16:31:12" duration="00:00:19.872">
>>> <properties>
>>> <type>PRACTICE</type>
>>> <software>SpeaK!</software>
>>> </properties>
>>> </session>
>>> <session start="2004-08-09 16:41:52" duration="00:00:27.915">
>>> <properties>
>>> <type>PRACTICE</type>
>>> <software>SpeaK!</software>
>>> </properties>
>>> <actions>
>>> <record start="00:00:23.364" wordId="37"
>>> filename="20040809_164216.spx" />
>>> <say start="00:00:25.702" wordId="37" />
>>> </actions>
>>> </session>
>>> </sessions>
>>> </historySubmit>
>>>
>>>
> Thanks for suggestion Merks, I tried that before and got error during
> validation/or did not see the data at all. The reason being these sub
> elements
> ("record", "say", "listen", "play","explain") could occur in any
> combination and each of this element can occur in any number of times
> within "action" element.
>
> I might not have mentioned this contraints in my last thread clearly.
>
> Thanks
> Susil
>
> ie; something like this:
> <action>
> <record></record>
> <record></record>
> <play></play>
> <listen></listen>
> <say></say>
> <explain></explain>
> <explain></explain>
> </action>
> <action>
> <play></play>
> <record></record>
> <listen></listen>
> <explain></explain>
> <explain></explain>
> <say></say>
> </action>
> <action>
> <play></play>
> <say></say>
> </action>
> <action>
> <record></record>
> <record></record>
> <record></record>
> </action>
> <action>
> <explain></explain>
> <explain></explain>
> <record></record>
> <record></record>
> <play></play>
> <play></play>
> <play></play>
> <listen></listen>
> <say></say>
> <say></say>
> </action>
> <action>
> <explain></explain>
> <explain></explain>
> <record></record>
> </action>
> <action>
> <say></say>
> <say></say>
> <say></say>
> </action>
>
|
|
|
Re: How to Create xml schema with any number of subelement(0-n) and in any order [message #590978 is a reply to message #50181] |
Tue, 24 August 2004 17:37  |
Eclipse User |
|
|
|
Ed Merks wrote:
> Susil,
>
> A repeating choice will allow you to make a different choice or the same
> choice each time, so you can literally have any combination of an
> abtirary number of subelements. I get the feeling now that you don't
> want just any combination, but rather if a given subelement occurrs more
> than once, all the occurrences must be adjancent. The only way to
> expess that, I think, would be as a choice of each possible ordering
> and by putting the min/maxOccurs on each element. I.e., like (A*B* |
> B*A*)....
>
>
> exquisitus wrote:
>
>> Ed Merks wrote:
>>
>>> Su,
>>>
>>> As in the previous append, <choice> with minOccurs="0" and
>>> maxOccurs="unbounded" of the subelements will validate any
>>> combination of zero or more subelements.
>>>
>>> exquisitus wrote:
>>>
>>>> Hi All,
>>>>
>>>> Seems like it did not post correctly first time. Anyway this is my
>>>> first post to this board.
>>>>
>>>> ----
>>>> I am working in an existing xml that has the following syntax:
>>>>
>>>> 1. element "actions" can have following elements more than once or
>>>> not at all:
>>>> : Sub elements "record", "say", "listen", "play","explain" as in xml
>>>> sample below
>>>> 2. These sub elements could be in any order
>>>>
>>>> Initially I thought of using "all" but it does not allow more than
>>>> one itration.
>>>>
>>>> What could be the xml schema definition for this scenario?
>>>>
>>>> Any help will be highly appreciated.
>>>>
>>>> Thanks
>>>> Su
>>>>
>>>> --------- Sample XML ------------------------------
>>>> Sample Xml:
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <historySubmit sessionId="17A5C33539093BEB3B74E0FEEE476240"
>>>> Version="1.0">
>>>> <sessions storyId="B5BB0DCB31F10C31E4DCC88ECF30F4EB" version="1.0">
>>>> <session start="2004-08-09 16:22:01" duration="00:03:21.122">
>>>> <properties>
>>>> <type>PRACTICE</type>
>>>> <software>SpeaK!</software>
>>>> </properties>
>>>> <actions>
>>>> <record start="00:00:10.083" wordId="0"
>>>> filename="20040809_162211.spx">
>>>> <w id="0" start="0" duration="540" result="MEDIUM" />
>>>> <w id="1" start="540" duration="440" result="FORCED" />
>>>> </record>
>>>> <record start="00:00:12.281" wordId="2"
>>>> filename="20040809_162213.spx" auto="True">
>>>> <w id="2" start="0" duration="580" result="BAD" />
>>>> <w id="3" start="580" duration="480" result="BAD" />
>>>> <w id="4" start="1230" duration="910" result="MEDIUM" />
>>>> <w id="5" start="2470" duration="210" result="FORCED" />
>>>> <w id="6" start="2680" duration="500" result="MEDIUM" />
>>>> <w id="7" start="3850" duration="370" result="MEDIUM" />
>>>> <w id="8" start="4340" duration="520" result="GOOD" />
>>>> <w id="9" start="4890" duration="370" result="BAD" />
>>>> <w id="10" start="5260" duration="210" result="FORCED" />
>>>> <w id="11" start="5470" duration="260" result="MEDIUM" />
>>>> <w id="11" start="5980" duration="330" result="MEDIUM" />
>>>> <w id="12" start="7340" duration="600" result="BAD" />
>>>> <w id="13" start="8530" duration="450" result="FORCED" />
>>>> </record>
>>>> <record start="00:00:22.130" wordId="14"
>>>> filename="20040809_162223.spx" auto="True">
>>>> <w id="14" start="0" duration="500" result="FORCED" />
>>>> </record>
>>>> <record start="00:00:24.141" wordId="15"
>>>> filename="20040809_162225.spx" auto="True">
>>>> <w id="15" start="0" duration="1020" result="MEDIUM" />
>>>> <w id="16" start="1020" duration="610" result="MEDIUM" />
>>>> <w id="17" start="1670" duration="450" result="MEDIUM" />
>>>> <w id="18" start="2480" duration="360" result="MEDIUM" />
>>>> <w id="19" start="2840" duration="410" result="MEDIUM" />
>>>> <w id="20" start="3250" duration="160" result="GOOD" />
>>>> <w id="21" start="3510" duration="190" result="FORCED" />
>>>> <w id="22" start="3700" duration="280" result="GOOD" />
>>>> <w id="23" start="4010" duration="480" result="MEDIUM" />
>>>> </record>
>>>> <play start="00:00:31.154" startId="24" stopId="26" />
>>>> <say start="00:00:33.601" wordId="36" />
>>>> <say start="00:00:34.629" wordId="37" />
>>>> <explain start="00:00:35.596" wordId="37" />
>>>> <play start="00:00:36.671" startId="37" stopId="40" />
>>>> <record start="00:00:40.069" wordId="40"
>>>> filename="20040809_162241.spx">
>>>> <w id="40" start="0" duration="970" result="MEDIUM" />
>>>> </record>
>>>> </actions>
>>>> </session>
>>>> <session start="2004-08-09 16:31:12" duration="00:00:19.872">
>>>> <properties>
>>>> <type>PRACTICE</type>
>>>> <software>SpeaK!</software>
>>>> </properties>
>>>> </session>
>>>> <session start="2004-08-09 16:41:52" duration="00:00:27.915">
>>>> <properties>
>>>> <type>PRACTICE</type>
>>>> <software>SpeaK!</software>
>>>> </properties>
>>>> <actions>
>>>> <record start="00:00:23.364" wordId="37"
>>>> filename="20040809_164216.spx" />
>>>> <say start="00:00:25.702" wordId="37" />
>>>> </actions>
>>>> </session>
>>>> </sessions>
>>>> </historySubmit>
>>>>
>>>>
>> Thanks for suggestion Merks, I tried that before and got error during
>> validation/or did not see the data at all. The reason being these sub
>> elements
>> ("record", "say", "listen", "play","explain") could occur in any
>> combination and each of this element can occur in any number of times
>> within "action" element.
>>
>> I might not have mentioned this contraints in my last thread clearly.
>>
>> Thanks
>> Susil
>>
>> ie; something like this:
>> <action>
>> <record></record>
>> <record></record>
>> <play></play>
>> <listen></listen>
>> <say></say>
>> <explain></explain>
>> <explain></explain>
>> </action>
>> <action>
>> <play></play>
>> <record></record>
>> <listen></listen>
>> <explain></explain>
>> <explain></explain>
>> <say></say>
>> </action>
>> <action>
>> <play></play>
>> <say></say>
>> </action>
>> <action>
>> <record></record>
>> <record></record>
>> <record></record>
>> </action>
>> <action>
>> <explain></explain>
>> <explain></explain>
>> <record></record>
>> <record></record>
>> <play></play>
>> <play></play>
>> <play></play>
>> <listen></listen>
>> <say></say>
>> <say></say>
>> </action>
>> <action>
>> <explain></explain>
>> <explain></explain>
>> <record></record>
>> </action>
>> <action>
>> <say></say>
>> <say></say>
>> <say></say>
>> </action>
>>
Thanks ED,
It working now. I was using it along with JAXB. The java object that was
created by JAXB names it in such a that it just pick first three
element( although it is able to retrun other element list)
Susil
|
|
|
Goto Forum:
Current Time: Tue Apr 29 02:19:53 EDT 2025
Powered by FUDForum. Page generated in 0.10022 seconds
|