Ho lo stesso problema anche io.. Qualcuno ha trovato una soluzione?

Più che altro non riesco proprio a leggere il contenuto del DTD dal file XML e se ci provo ottengo risultati molto strani..

Posto qui il mio codice
codice:
 Document doc=null;
 String filename=file;

 DocumentBuilder db = null;
 DocumentBuilderFactory dbf =DocumentBuilderFactory.newInstance();

 try {
   db = dbf.newDocumentBuilder();
 } catch (ParserConfigurationException pce) {  }

 try {
   doc = db.parse(new File(filename));
 } catch (SAXException se){
 } catch (IOException ioe){ System.err.println(ioe);  }

 // Cerca il primo ELEMENT TYPE
 boolean cerca=true;

 Node child = doc.getFirstChild();

 short typeret = child.getNodeType();
 while (cerca)
 {
   if (typeret != Node.ELEMENT_NODE){

    out.print(child.toString()); //CON QUESTO COMANDO DOVREBBE STAMPARE ANCHE IL DTD
    child = child.getNextSibling();
    typeret = child.getNodeType();
   
   }else   cerca = false;
 }

/*PARTE IN CUI ELABORO IL DOCUMENTO, TOLTA PERCHE' ININFLUENTE PER L'ESEMPIO*/


//Stampa del documento modificato(successivamente potrei stampare dove voglio)
  out.println(child.toString());