Hi, I'm new with Java graphic. I have an xml file with the informations
about the slots (attribute) of each module of my sistem, like
<module name="NomeComponente" type="action">
<phase>1</phase>
<level>2</level>
<basic>
<caption>front-office telefonico</caption>
<description>modulo per la gestione degli appuntamenti di
primo livello: possibilit? di confermarli, modificarli o
rifiutarli. In caso di rifiuto l'operatore pu?
registrarne il motivo</description>
</basic>
<auto-execute>false</auto-execute>
<sequencing>
<previous_step>nomeComponentePrecedente</previous_step>
<next_step>nomeComponenteSuccessivo</next_step>
</sequencing>
<permissions>
<read>id_operatore1;id_operatore2;...;id_operatoreN</read>
<execute>id_operatore1;id_operatore2;...;id_operatoreN</execute>
</permissions>
< </module>
I have to buil a GUI from these informations with a panel that
shows them (for each attribute a lable and a text field I think, so the user
can read the attribute and modify it). I think I need an xml parser to store
the attributes of each module an present them. is there a ready parser
written in Java I can modify for my aim? Can someone help me?
Thanks in advance
Martino
Here's what I would do. Read in the XML using SAXParser, and your own
"handler". Something like:
MyHandler handler = hew MyHandler();
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
parser.parse(<File>, handler);
...
class MyHandler extends DefaultHandler {
<see the JavaDoc for DefaultHandler to know how to parse
XML elements as they are read from file.>
<use this handler to fill in objects that contain the data
you will eventually use to populate your GUI>
}
------------------
Your GUI would call the above parsing routines to parse the XML file,
and then use the data acquired in "MyHandler" to build whatever
components
it needs.
Hope that helps.
...bob
> Hi, I'm new with Java graphic. I have an xml file with the informations
> about the slots (attribute) of each module of my sistem, like
[quoted text clipped - 11 lines]
> <description>modulo per la gestione degli appuntamenti di
> primo livello: possibilità di confermarli,
modificarli o
> rifiutarli. In caso di rifiuto l'operatore
può
> registrarne il motivo</description>
>
[quoted text clipped - 11 lines]
>
> <permissions>
<read>id_operatore1;id_operatore2;...;id_operatoreN</read>
<execute>id_operatore1;id_operatore2;...;id_operatoreN</execute>
> </permissions>
>
[quoted text clipped - 9 lines]
>
> Martino