For XML Schema gurus - populate 2 combo boxes from schema data

J

Joyce

The XML Schema design problem to solve is as follows:

We have 2 combo boxes to populate from schema data, let's say:

1. States
2. Cities (and this one gets populated depending on the choice of the
state)

The event management is no problem, the question is, how do we build
our XML Schema (that's going to contain the data for both states and
cities, as we use it to validate the XML that we generate based on the
forms from it, so both have a double purpose), so that we can link
states and cities?
We're using XML Beans as our object model for the schema, and our
application is built in Swing.
We have some other combo boxes based in enumerations, those are OK,
but in this case we have to make a link so that we cannot have one
single huge cities enumeration (and to make sure we don't get funny
state-city matches).

So far we have seen that this might be a possible solution, but as XML
Beans refer to objects by name, we need some sort of link between
state codes and state names...

(there might be typos here...)

<complexType name="STATE1">
<sequence>
<element name="STATENAME" fixed="here_goes_state_name"/>
<element name="CITIES">
<simpleType>
<restriction base="string">
<enumeration value="here_go_city_names"/>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>

Then we would have the list of state codes, something like this:

<simpleType name="STATE_ENUM">
<restriction base="int">
<enumeration value="1"/>
<!-- more codes here -->
</restriction>
</simpleType>

We would put all the states (1..n) in some sort of parent collection
so that we would get them in order, as the codes in the STATES_ENUM.
The XML Beans don't have any generic method to get all the children
for a given element, you have to refer them by class name (that's
quite a problem in this case).

We would probably have a separate list for state names, just to
populate the state combo (labels as names, codes as digits that would
go in the generated XML created from the user's choices).

It'd all be a lot easier if we had simple XML files, not schemas, but
it seems there can be no mixture of both (besides, the XML beans do
not allow to generate an object model from an XML file, and we need
the validation for the state and city data in the schema)

does this seem correct? if not, any suggestions?

thanks in advance

Joyce
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top