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
|
private void loadfile(File fichier) {
chemin.setText("Le chemin: " + fichier);
Element racine;
Document document;
try{
SAXBuilder sxb = new SAXBuilder();
document = sxb.build(fichier);
racine = document.getRootElement();
try{XPath xp=XPath.newInstance("//owl:Module_enseignement/@rdf:ID");
xp.addNamespace("owl", "http://www.owl-ontologies.com/Ontology1265893389.owl#");
xp.addNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
for(Attribute B : (List<Attribute>)xp.selectNodes(racine)){
System.out.println(B.getValue());
}
XPath xpa = XPath.newInstance("//owl:Module_enseignement/owl:aborde/@rdf:resource");
xpa.addNamespace("owl", "http://www.owl-ontologies.com/Ontology1265893389.owl#");
xpa.addNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
for(Attribute a : (List<Attribute>)xpa.selectNodes(racine)){
System.out.println(a.getValue());
}
}catch (JDOMException e ){}
}catch(Exception e){
e.printStackTrace();
}
} |
Partager