Olá.
Estou com problema para ler um arquivo XML.
No início do meu arquivo XML tem um arquivo com sufixo “.dtd”, e é
justamente esse arquivo que está dando erro.
meu XML :
<?xml version="1.0" encoding="utf-8" ?> audio 8 yes 1 3 always VXKB001.DLL VXVD001.DLL VXHS001.DLLMsg de erro : “External entity not
found: “file:/D:/Projetos/Java/Voxlans/C:\VOXLANS\BIN\VOXconfg.dtd”.”
Observação: O arquivo VOXconfg.dtd está no diretório correto.
o método que lê o arquivo XML :
public static int lePorta(String sTagPerif) throws Exception
{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse( "D:\\Projetos\\Java\\Voxlans\\VOXconfg.xml" );
Element elem = doc.getDocumentElement();
// pega o elemento sTagPerif do XML.
NodeList node = elem.getElementsByTagName( sTagPerif );
// pega os atributos de sTagPerif
Element tag = (Element) node.item( 0 );
int iPort = Integer.parseInt( tag.getAttribute( "port" ) );
return iPort;
}
Antecipadamente agradeço.