Hi.
 
I'm using the SAXParser implemented in Xerces 2.0 Beta.
 
In the XML specification, I read that a parser "may" issue warnings when one of the following is encountered :
 
- an XML processor may issue a warning when a declaration mentions an element type for which no declaration is provided, but this is not an error.
- an XML processor may issue a warning if attributes are declared for an element type not itself declared, but this is not an error
- an XML processor may at user option issue a warning when more than one attribute-list declaration is provided for a given element type, or more than one attribute definition is provided for a given attribute, but this is not an error.
- an XML processor may issue a warning if entities are declared multiple times.
 
I would like to know if the SAXParser I am using is generating such warning or not.
 
I've tried to provoke these warnings including some mistakes in my DTD but it seemed not to work.
 
Here is the code I used in my executable class :
 
  SAXParserFactory factory = SAXParserFactory.newInstance();
  SAXParser saxParser = factory.newSAXParser();
  MyEventHandler myHandler = new MyEventHandler();
  myReader.setErrorHandler(myHandler);
  myReader.setContentHandler(myHandler);
  myReader.parse(arg[0]);
and the code of my EventHandler class:
 
public class MyEventHandler extends DefaultHandler
{
public MyEventHandler()
{
 super();
}

 public void error(SAXParseException e)
 throws SAXParseException
 {
 System.out.println("error");
  throw e;
 }

public void warning(SAXParseException exception) throws SAXParseException {
 System.out.println("warning");
 exception.printStackTrace();
}
}
 
Thanks.
 
 
                                                                Jean-Guillaume.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to