oui je comprends ces termes
mais le problème que je dois écrire un algorithme qui permet d'enrichir un fichier xml initial (n'importe quel fichier xml , j'ai choisi par exple ce genre de fichier) , de l'enrichier par les 3 couches (application,dialgue,présentation) du modèle Seeheim (comme le modèle MVC)
je vs donne un exemple de fichier initial (avec le réseau de pétri)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| - <pnml xmlns="http://www.informatik.hu-berlin.de/top/pnml/ptNetb">
- <net>
- <place>
- <name>
<text>ApplicationClosed</text>
</name>
- <initialMarking>
<text>0</text>
</initialMarking>
</place>
- <place>
- <name>
<text>SessionOpened</text>
</name>
- <initialMarking>
<text>0</text>
</initialMarking>
</place>
- <place>
- <name>
<text>GivePlentyWater</text>
</name>
- <initialMarking>
<text>1</text>
</initialMarking>
</place>
- <place>
- <name>
<text>WaterGiven</text>
</name>
- <initialMarking>
<text>0</text>
</initialMarking>
</place>
- <place>
- <name>
<text>UrineLevy</text>
</name>
- <initialMarking>
<text>0</text>
</initialMarking>
</place>
- <place>
- <name>
<text>UrineLevied</text>
</name>
- <initialMarking>
<text>0</text>
</initialMarking>
</place>
- <transition>
- <name>
<text>OpenSession</text>
</name>
</transition>
- <transition>
- <name>
<text>CriticalIntervention</text>
</name>
</transition>
- <transition>
- <name>
<text>GivingWater</text>
</name>
</transition>
- <transition>
- <name>
<text>PrepareUrineLevy</text>
</name>
</transition>
- <transition>
- <name>
<text>LevyingUrine</text>
</name>
</transition>
- <transition>
- <name>
<text>TaskFinished</text>
</name>
</transition>
<arc id="ApplicationClosedToOpenSession" source="ApplicationClosed" target="OpenSession" />
<arc id="OpenSessionToSessionOpened" source="OpenSession" target="SessionOpened" />
<arc id="SessionOpenedToCriticalIntervention" source="SessionOpened" target="CriticalIntervention" />
<arc id="CriticalInterventionToGivePlentyWater" source="CriticalIntervention" target="GivePlentyWater" />
<arc id="GivePlentyWaterToGivingWater" source="GivePlentyWater" target="GivingWater" />
<arc id="GivingWaterToWaterGiven" source="GivingWater" target="WaterGiven" />
<arc id="WaterGivenToPrepareUrineLevy" source="WaterGiven" target="PrepareUrineLevy" />
<arc id="PrepareUrineLevyToUrineLevy" source="PrepareUrineLevy" target="UrineLevy" />
<arc id="UrineLevyToLevyingUrine" source="UrineLevy" target="LevyingUrine" />
<arc id="LevyingUrineToUrineLevied" source="LevyingUrine" target="UrineLevied" />
<arc id="UrineLeviedToTaskFinished" source="UrineLevied" target="TaskFinished" />
<arc id="TaskFinishedToApplicationClosed" source="TaskFinished" target="ApplicationClosed" />
</net>
</pnml> |
Le fichier cible (final) doit décrire une interface graphique avec les informations du fichier initial : càd le fichier final contient les 3 couches suivantes:
application qui décrit la sémantique: concerne le niveau fonctionnel (les méthodes)
dialogue qui décrit la syntaxe: concerne le niveau dialogue et communication entre le sémantic et le lexical (les évenement; exple:clique boutton, ...)
présentation qui décrit le niveau lexical: concerne le niveau présentation et affichage des objets de l interface (les bouton, textField,...)
1) tout d'abord,si vous pouvez m'aider pour savoir (à peut prés) comment va etre la structure de mon fichier xml final, pour que je puisse comprendre mieux
2)Comment insérer chaque partie (la partie application,dialgue,présentation) ds le fichier (le but est d'enrichier le fichier XML initial)
pour la lecture du fichier , j'ai trouvé qu'il faut travailler avec le JDom
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
import java.io.*;
import java.util.List;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
public class JDom{
static Document document;
static Element racine;
public static void main(String[] args){
//On crée une instance de SAXBuilder
SAXBuilder sxb = new SAXBuilder();
try{
//On crée un nouveau document JDOM avec en argument le fichier XML
//Le parsing est terminé ;)
document = sxb.build(new File("Nurse.xml"));
}catch(Exception e){}
//On initialise un nouvel élément racine avec l'élément racine du document.
racine = document.getRootElement();
} |
pour la récupération des données du xml initial :
List<Element> elements = document.getRootElement().getChildren("elements");
Merci pour votre aide
Partager