Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » XML and JDOM
XML and JDOM [message #880284] Fri, 01 June 2012 15:03 Go to previous message
Hela Hakim is currently offline Hela Hakim
Messages: 20
Registered: May 2012
Junior Member
Hello all,
this is a XML file (generated by papyrus (. uml)).

*****file XML*******
see joint
********************
I am willing to go before I draw the handle.
This is a JAVA code for the following parcour and display an attribute "xmi: version" of the root. but the display is null, why?

*****code de la classe JDOM2*********
import java.io.*;
import org.jdom2.*;
import org.jdom2.input.*;
import java.util.List;
import java.util.Iterator;
public class JDOM2
{
static org.jdom2.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 
document = sxb.build(new File("C:\\Users\\Hela\\Desktop\\HelaEclipseJDK\\Etudedecas\\etude.uml"));
}
catch(Exception e){}
//On initialise un nouvel élément racine avec l'élément racine du document.
racine = document.getRootElement();
System.out.println(racine.getAttributeValue("xmi:version"));

}}

thanks for your help Smile
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:UML2 4.0 Migration Guide
Next Topic:qualified association
Goto Forum:
  


Current Time: Sat May 25 08:12:09 EDT 2013

Powered by FUDForum. Page generated in 0.02779 seconds