Galera estou com problemas com a api JDOM.
eu tenho seguinte código , ele compila blz. mas quando executo dá este erro alguém sabe o pq?
package com.javale.XML;
import org.jdom.*;
import org.jdom.input.SAXBuilder;
import java.io.IOException;
import java.util.*;
public class XMLParser {
public static void main(String[] args) {
SAXBuilder builder = new SAXBuilder();
try {
Document doc = builder.build("/home/wanderson/workspace/XMLParser/tabela.xml");
Element root = doc.getRootElement();
listChildren(root, 0);
}
// indicates a well-formedness error
catch (JDOMException e) {
System.out.println(args[0] + " is not well-formed.");
System.out.println(e.getMessage());
}
catch (IOException e) {
System.out.println(e);
}
}
public static void listChildren(Element current, int depth) {
printSpaces(depth);
System.out.println(current.getName());
List children = current.getChildren(); <== O ERRO OCORRE AQUI NO MÉTODO GETCHILDREN()
Iterator iterator = children.iterator();
while (iterator.hasNext()) {
Element child = (Element) iterator.next();
listChildren(child, depth+1);
}
}
private static void printSpaces(int n) {
for (int i = 0; i < n; i++) {
System.out.print(' ');
}
}
}
Root
Exception in thread "main" java.lang.VerifyError: (class: org/jdom/ContentList$FilterList, method: size signature: ()I) Illegal use of nonvirtual function call
at org.jdom.ContentList.getView(ContentList.java:399)
at org.jdom.Element.getChildren(Element.java:1408)
at com.javale.XML.XMLParser.listChildren(XMLParser.java:37)
at com.javale.XML.XMLParser.main(XMLParser.java:19)
Abraços