bonjour,
est ce que je peux en utilisant Jdom lorsque je parse un fichier XML pour chaque lecture de sa balise je parse un autre fichier car j'ai écrit un code qui fait ça mais ça marche pas.merci
bonjour,
est ce que je peux en utilisant Jdom lorsque je parse un fichier XML pour chaque lecture de sa balise je parse un autre fichier car j'ai écrit un code qui fait ça mais ça marche pas.merci
aroua,
fait voir ton code parce que la je crois comprendre ce que tu veux faire mais ton code pourra plus nous aider
merci
voilà mon code:la ligne: parseeeeeeeeeeeeeeeeeeeeeeeeee ne s'affiche pas et un message d'eereur s'affiche puisque j'ai pas rempli ma matrice
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 public void SimlpeKmeans(String pathpatentnumber, String Result ){ int [][]mat = null; String name; String number; String in; int freq; boolean ok=false; Vector vect=new Vector(); Vector dataPoints = new Vector(); vect= getConceptName (this.pathcpt); org.jdom.Document document; Element racine; org.jdom.Document document2; Element racine2; String patidfile; Element courant2 = null; SAXBuilder sxb = new SAXBuilder(); try { document = sxb.build(new File(pathpatentnumber)); racine=document.getRootElement(); List listNumber =racine.getChildren("Number"); //On crée un Iterator sur notre liste Iterator i = listNumber.iterator(); int l=0; while (i.hasNext()) { Vector petitvect = new Vector(); Element courant = (Element)i.next(); number= courant.getText(); System.out.println("voici le patent:"+number); patidfile=Result+"/"+number+"/"+number.replaceAll(",", "")+".xml"; //mat=FrequencyConcept(vect,this.patidfile,l); System.out.println(patidfile); document2 = sxb.build(new File(patidfile)); System.out.println("je parseeeeeeeeeeeeeeeee"); racine2=document2.getRootElement(); List listConcept =racine2.getChildren("Concept"); Iterator h= listConcept.iterator(); for (int k=0; k < vect.size(); l++) { System.out.println(vect.elementAt(k)); while ((h.hasNext()) && (ok==false)) { courant2 = (Element)h.next(); in=( (Element) courant2.getChildren("Name")).getText(); if (in.equals(vect.elementAt(k))) { ok=true;} } if (ok==false) {mat[l][k]=0; } else { freq = Integer.parseInt(((Element)courant2.getChildren("frequency")).getText()); mat[l][k]=freq;} } for(int p=0; p < mat[0].length ; p++){ petitvect.addElement(mat[l][p]); } l++; dataPoints.add(new PatentData(petitvect,number)); } }catch(Exception e){} SimpleKmeans jca = new SimpleKmeans(5,1000,dataPoints); jca.startAnalysis(); Vector[] v = jca.getClusterOutput(); for (int i=0; i<v.length; i++){ Vector tempV = v[i]; System.out.println("-----------Cluster"+i+"---------"); Iterator iter = tempV.iterator(); while(iter.hasNext()){ PatentData dpTemp = (PatentData)iter.next(); //System.out.println(dpTemp.getObjName()+"["+dpTemp.getX()+","+dpTemp.getY()+"]"); } } }
Je pense pas que le message "parseeeeeeeee" ne s affiche pas car tu ne rempli pas ta matrice vu que tu t en sert pas pour creer ton second doc et jusqua "parseeeeeeeeeee" ...
fait voir le message d erreur que tu as
c'est le message d'erreur:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Unknown Source)
at fr.inria.edelweiss.sealife.ClusteringAlgo.SimpleKmeans.setInitialCentroids(SimpleKmeans.java:143)
at fr.inria.edelweiss.sealife.ClusteringAlgo.SimpleKmeans.startAnalysis(SimpleKmeans.java:48)
at fr.inria.edelweiss.sealife.ClusteringAlgo.PrgMain.SimlpeKmeans(PrgMain.java:177)
at fr.inria.edelweiss.sealife.PatentMining.main.test.main(test.java:180)
mais j'arrive pas à afficher le message parseeeeeeeeeee donc il est clair que mon code ne parse pas le 2ème fichier de chemin patidfile
oui ca viens d un vecteur mais pourtant tu ne les utilise pas avant ...
peut etre que c'est :
vect= getConceptName (this.pathcpt);
essaye de mettre entre com
Sinon
tu as cette ligne qui s affiche ?? : System.out.println(patidfile);
Partager