Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > For XML Schema gurus - populate 2 combo boxes from schema data

Thread Tools

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

Posts: n/a
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

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">
<element name="STATENAME" fixed="here_goes_state_name"/>
<element name="CITIES">
<restriction base="string">
<enumeration value="here_go_city_names"/>

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 -->

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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
web.xml / XML schema issue, why do some XML schema attributes disappear Java 3 02-20-2007 09:56 AM
Hi tech gurus combo box help =?Utf-8?B?cmFt?= MCSE 2 12-20-2005 12:13 PM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
Populate a popup window with clickable records from an Access DB and upon clicking, populate a selectbox on the original webpage with the clicked record Enjoy Life ASP General 2 02-23-2005 10:48 PM
Code to populate combo Mark Goldin ASP .Net 2 08-03-2004 12:34 PM