Code example for XMLReader

Methods: setProperty

0
      SAXParser parser = spfact.newSAXParser();
      XMLReader reader = parser.getXMLReader();
       
      //Instantiate inner-class error and lexical handler. 
      Handler handler = new Handler(filename, errorBuff);
      reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
      parser.parse(input, handler);
 
      if (handler.containsDTD && !handler.errorOrWarning) // valid
      { 
        buff.append("VALID " + filename +"\n");
        numValidFiles++;
      } 
      else if (handler.containsDTD) // not valid
      { 
        buff.append ("NOT VALID " + filename + "\n");
        buff.append(errorBuff.toString());
        numInvalidFiles++;
      } 
      else // no DOCTYPE to use for validation 
      {