Erro com JDOM. O que será?

0 respostas
wandersonxs

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?

Estou usando JDOM 1.0 e JSDK 1.4.02. List children = current.getChildren() <==O ERRO OCORRE NO MÉTODO GETCHILDREN() Código:
package com.javale.XML;
import org.jdom.*;
import org.jdom.input.SAXBuilder;
import java.io.IOException;
import java.util.*;


public class XMLParser &#123;

  public static void main&#40;String&#91;&#93; args&#41; &#123;
  
   
      
    SAXBuilder builder = new SAXBuilder&#40;&#41;;
     
    try &#123;
      Document doc = builder.build&#40;&quot;/home/wanderson/workspace/XMLParser/tabela.xml&quot;&#41;;
      Element root = doc.getRootElement&#40;&#41;;
      listChildren&#40;root, 0&#41;;      
    &#125;
    // indicates a well-formedness error
    catch &#40;JDOMException e&#41; &#123; 
      System.out.println&#40;args&#91;0&#93; + &quot; is not well-formed.&quot;&#41;;
      System.out.println&#40;e.getMessage&#40;&#41;&#41;;
    &#125;  
    catch &#40;IOException e&#41; &#123; 
      System.out.println&#40;e&#41;;
    &#125;  
  
  &#125;
  
  
  public static void listChildren&#40;Element current, int depth&#41; &#123;
   
    printSpaces&#40;depth&#41;;
    System.out.println&#40;current.getName&#40;&#41;&#41;;
    List children = current.getChildren&#40;&#41;; &lt;==  O ERRO OCORRE AQUI NO MÉTODO GETCHILDREN&#40;&#41;
    Iterator iterator = children.iterator&#40;&#41;;
    while &#40;iterator.hasNext&#40;&#41;&#41; &#123;
      Element child = &#40;Element&#41; iterator.next&#40;&#41;;
      listChildren&#40;child, depth+1&#41;;
    &#125;
    
  &#125;
  
  private static void printSpaces&#40;int n&#41; &#123;
    
    for &#40;int i = 0; i &lt; n; i++&#41; &#123;
      System.out.print&#40;' '&#41;; 
    &#125;
    
  &#125;

&#125;
Erro:
Root
Exception in thread &quot;main&quot; java.lang.VerifyError&#58; &#40;class&#58; org/jdom/ContentList$FilterList, method&#58; size signature&#58; &#40;&#41;I&#41; Illegal use of nonvirtual function call
	at org.jdom.ContentList.getView&#40;ContentList.java&#58;399&#41;
	at org.jdom.Element.getChildren&#40;Element.java&#58;1408&#41;
	at com.javale.XML.XMLParser.listChildren&#40;XMLParser.java&#58;37&#41;
	at com.javale.XML.XMLParser.main&#40;XMLParser.java&#58;19&#41;

Abraços

Criado 29 de outubro de 2004
Respostas 0
Participantes 1