Processing Ant Schema

A

Arun

I have a dtd created from calling antstructure in an ant build file.

I would like to know how to process an ant file through this dtd and
getting an output depending on if the ant file is a valid ant file.
Can anyone help?
 
G

Gibsonist

I use something like this to use a SAX parser to validate via DTD - if
the XML is properly coded.

....SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
try {
SAXParser saxParser = factory.newSAXParser();
saxParser.parse(new InputSource(source), this);
} catch (Exception e) {
System.err.print("Exception: ");
System.err.println(e.toString());
return null;
}
....
public void error(SAXParseException e) throws SAXParseException {
throw e;
}


public void warning(SAXParseException err) throws SAXParseException
{
System.out.println("** Warning" + ", line " +
err.getLineNumber()
+ ", uri " + err.getSystemId());
System.out.println(" " + err.getMessage());
} ...

It might be that I am missing a method or so but this should basicly be
it.

Gibsonist
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top