Jump to content

Unordered Elements


Chrille
 Share

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.

Link to comment
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!
Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...