Jump to content
Chrille

Unordered Elements

Recommended Posts

Hi, I'm working on an XML definition of a web application and I need to create an XML Schema for this definition. However I'm having trouble with the order of the elements. With the xs:sequens tag I can get a specified order of the selected elements as the following code shows:

<xs:element name="Panel" maxOccurs="unbounded">	<xs:complexType mixed="true">	    <xs:sequence>		<xs:element name="Button" minOccurs="0" maxOccurs="unbounded">			...		</xs:element>		<xs:element name="Image" minOccurs="0" maxOccurs="unbounded">                        ...		</xs:element>	    </xs:sequence>	</xs:complexType></xs:element>

This makes it possible to create a Panel element and within it add Button and Image elements in sequence where the Button element/elements have to be added before the Image element/elements. But how do i define in the XML Schema that the Button and Image element can appear in whatever order and numbers as in the example below?

<Panel>     <Image/>     <Button/>     <Button/>     <Image/>     <Button/>     ...</Panel>

I cant't find the specified functionality and I am thankful for all the help I can get.

Share this post


Link to post
Share on other sites

Use xs:all instead of xs:sequence.

Share this post


Link to post
Share on other sites
Use xs:all instead of xs:sequence.
Thank you for your reply!I tried the xs:all element instead, but as I understand it this element is restricted to 0 or 1 occurences of the button and image element. How would I use this element to permit an unbounded amount of button and image elements?Thanks in advance!

Share this post


Link to post
Share on other sites

Hello,I found another approach that seems to fulfill my intentions. With the use of the xs:choice element inside of the xs:sequence tag I can specify the maxOccurs attribute to "unbounded" and choose between the included elements:

<xs:element name="Panel" maxOccurs="unbounded">	<xs:complexType mixed="true">	    <xs:sequence>                <xs:choice maxOccurs="unbounded">		     <xs:element name="Button" minOccurs="0" maxOccurs="unbounded">			    ...		     </xs:element>		     <xs:element name="Image" minOccurs="0" maxOccurs="unbounded">                            ...		     </xs:element>                </xs:choice>	    </xs:sequence>	</xs:complexType></xs:element>

I don't know if this is a preferrable solution but it seems to work anyway.

Share this post


Link to post
Share on other sites

I have always used PSE, now on PSE7. It seems as if over the years, they took features from older PS versions and added them into Elements. I would do a search for feature lists of both and compare them. I now use LR and only use PSE when designing posters.Having both of these programs saves me from spending money on CS4

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...