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

Discussion in 'XML' started by Joyce, Mar 1, 2005.

  1. Joyce

    Joyce Guest

    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
     
    Joyce, Mar 1, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Code to populate combo

    Mark Goldin, Aug 3, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    370
    Kevin Spencer
    Aug 3, 2004
  2. Adrian
    Replies:
    1
    Views:
    235
    Bullschmidt
    Feb 18, 2004
  3. Lukelrc

    Populate a combo with an array

    Lukelrc, May 19, 2004, in forum: ASP General
    Replies:
    10
    Views:
    207
    Roland Hall
    May 22, 2004
  4. dthmtlgod

    Fill Combo Box based on another Combo Box

    dthmtlgod, Nov 16, 2005, in forum: ASP General
    Replies:
    1
    Views:
    604
    Bob Barrows [MVP]
    Nov 16, 2005
  5. SM
    Replies:
    2
    Views:
    381
Loading...

Share This Page