Bonjour,
J'ai un problème avec l'api Java Sax :
Voici un bout de mon fichier Xml :
Code XML : 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 <lexicalEntry id="coronoïde_1"> <formSet> <lemmatizedForm> <orthography>coronoïde</orthography> <grammaticalCategory>adjective</grammaticalCategory> </lemmatizedForm> <inflectedForm> <orthography>coronoïde</orthography> <grammaticalNumber>singular</grammaticalNumber> <grammaticalGender>masculine</grammaticalGender> </inflectedForm> <inflectedForm> <orthography>coronoïdes</orthography> <grammaticalNumber>plural</grammaticalNumber> <grammaticalGender>masculine</grammaticalGender> </inflectedForm> <inflectedForm> <orthography>coronoïde</orthography> <grammaticalNumber>singular</grammaticalNumber> <grammaticalGender>feminine</grammaticalGender> </inflectedForm> <inflectedForm> <orthography>coronoïdes</orthography> <grammaticalNumber>plural</grammaticalNumber> <grammaticalGender>feminine</grammaticalGender> </inflectedForm> </formSet> <originatingEntry target="TLF">CORONOÏDE, adj.</originatingEntry> </lexicalEntry>
Je souhaite récupérer les orthographes, c'est à dire les valeurs entre les balises <orthography>.
Pour cette exemple, il me sort :
Le problème est pour le 3ème, il ne me donne que les trois derniers caractères.coronoïde
coronoïde
des
coronoïde
coronoïdes
Cela est due à ma méthode :
La taille du tableau ch est de 2048 caractères. Après avoir afficher des traces, il lit le mot "cornoïdes" dans 2 tableaux différents :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 public void characters(char[] ch, int start, int length) throws SAXException { tempVal = new String(ch,start,length); }
"cornoï" start = 2037 length = 7
"des" start = 0 length = 3
et je ne récupère que la 2eme partie.
Bref, je n'y comprends pas grand chose et ne sais pas pourquoi il lit le fichier comme cela....
Peut être que me méthode pour lire n'est pas la bonne.
Si quelqu'un peut m'aider... merci d'avance!
Alex.
Partager