ここで私が間違っていることは何ですか。
これはxmlファイルです
<text xml:space="preserve">{{Redirect|Anarchist|the fictional character|Anarchist (comics)}}
{{Redirect|Anarchists}}
{{Anarchism sidebar}}
{{Libertarianism sidebar}}
</text>
SAXパーサーを使用して解析しているとき、たとえばこれは私の文字メソッドです
public void characters (char ch[], int start, int length) throws SAXException{
System.out.println(text);
if (text){
System.out.println(testData); //testData is StringBuilder
if (testData != null){
for (int j=start; j < (start + length); j++){
testData.append(ch[j]);
}
}
}
text = false
}
これは私の startElement メソッドです
public void startElement(String uri, String localname, String qName, Attributes attributes) throws SAXException {
if (qName.equalsIgnoreCase("text")) {
text = true;
}
}
しかし、私のキャラクター関数は一度だけ呼び出されます。何度か呼び出されると思ったので、