dleslie     01/11/06 06:34:25

  Modified:    java/samples/Validate ValidateXMLInput.java
  Log:
  Editorial cleanup, including try/catch.
  
  Revision  Changes    Path
  1.3       +17 -5     xml-xalan/java/samples/Validate/ValidateXMLInput.java
  
  Index: ValidateXMLInput.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/samples/Validate/ValidateXMLInput.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ValidateXMLInput.java     2001/11/05 19:28:49     1.2
  +++ ValidateXMLInput.java     2001/11/06 14:34:25     1.3
  @@ -81,16 +81,18 @@
    */
   public class ValidateXMLInput
   {
  +  
     public static void main(String[] args) 
       throws Exception
     {
       ValidateXMLInput v = new ValidateXMLInput();
  -    v.validateInput();
  +    v.validate();
     }
  -  void validateInput()
  +
  +  void validate()
       throws Exception
  -  {
  -    // Since we're going to use a SAX feature, the transformer must support 
  +   {
  +     // Since we're going to use a SAX feature, the transformer must support 
       // input in the form of a SAXSource.
       TransformerFactory tfactory = TransformerFactory.newInstance();
       if(tfactory.getFeature(SAXSource.FEATURE))
  @@ -117,7 +119,17 @@
           new InputSource("birds.xml"));
         
         // Transform to a file.
  -      t.transform(source, new StreamResult("birds.out"));
  +      try
  +      {
  +        t.transform(source, new StreamResult("birds.out"));
  +      }
  +      catch (TransformerException te)
  +      {
  +        // The TransformerException wraps someting other than a 
SAXParseException
  +        // warning or error, either of which should be "caught" by the 
Handler.
  +        System.out.println("Not a SAXParseException warning or error: " + 
te.getMessage());
  +      }
  +                                  
         System.out.println("=====Done=====");
       }
       else
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to