Java and parsing xsd tu build a gui

T

TIANA

Hi guys,
unfortunately i'm a newbee to java and xml and xsd...
part of my xsd looks like this:
<xs:simpleType name="val">
<xs:restriction base="xs:string">
<xs:enumeration value="aa"></xs:enumeration>
<xs:enumeration value="bb"></xs:enumeration>
<xs:enumeration value="cc"></xs:enumeration>
</xs:restriction>
</xs:simpleType>

could anyone give me a hint, how to parse my xsd in java
to fill a combobox out of the values in the enumeration tags?
I guess I have to work around with jdom?!?
I'm working with java 1.4.1..
would be glad for any help or hint
thanks in advance
tiana
 
G

gabriel

TIANA said:
Hi guys,
unfortunately i'm a newbee to java and xml and xsd...
part of my xsd looks like this:
<xs:simpleType name="val">
<xs:restriction base="xs:string">
<xs:enumeration value="aa"></xs:enumeration>
<xs:enumeration value="bb"></xs:enumeration>
<xs:enumeration value="cc"></xs:enumeration>
</xs:restriction>
</xs:simpleType>

could anyone give me a hint, how to parse my xsd in java
to fill a combobox out of the values in the enumeration tags?
I guess I have to work around with jdom?!?
I'm working with java 1.4.1..
would be glad for any help or hint
thanks in advance
tiana

Greetings,

you're right with jdom : look in the samples files or if I rememebr
correctly there are some pdf slides with sample codes.

http://www.jdom.org/downloads/oraoscon01-jdom.pdf pages 23 - 33

this is what you have to do :
find the xs:restriction element whose attribute name is "val".
get its children into a collection of nodes.
parse the collection and put each value (String) in a Vector.

Then create your combo box in swing and fill it with the vector you have
just created.

you're done :)

Good luck !
 
G

gimme_this_gimme_that

Alternatively, you could use a pattern matching package like
Jakarta-ORO.
 

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,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top