Guest elSto Posted November 24, 2005 Share Posted November 24, 2005 Hello together,I've a problem. I'd like to check my xml file with a dtd.The situation:test.log don't has a root tag and isn't correct.document.xmlsurrounds the test.log with a root tag-----------------<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE messages SYSTEM "test.log.dtd"><myroot> &test;</myroot>test.log.dtdhas a ENTITY with the filname (file.log)-------------------<?xml version="1.0" encoding="UTF-8"?><!ENTITY test SYSTEM "tunit-events.log"><!ELEMENT myroot (element*)>...I read the file (f = document.xml) with sax---------------------------------------------public void testXML(File f) { System.out.print("Validate logfile ..."); SAXBuilder builder = new SAXBuilder(); builder.setFeature("http://xml.org/sax/features/validation", true); Document document = null; try { System.out.print(" File to validate: " + f.getName() + " ..."); document = builder.build(f.getName()); } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println("done !");}-------------------------------------------The problem is now, that it don't check the file. It don't gives me an error.Does someone has a solution for that problem?thanx for your help.greez elStops. sorry about my english i'm from switzerland Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now