ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional SchemaValidate.java XMLValidateTask.java
Date Wed, 23 Feb 2005 13:04:16 GMT
stevel      2005/02/23 05:04:16

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional
                        SchemaValidate.java XMLValidateTask.java
  Log:
  lower success message to verbose output on schema validation. Could do the same for XmlValidate,
and indeed, am sorely tempted to. Also added some javadocs.
  
  Revision  Changes    Path
  1.5       +22 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
  
  Index: SchemaValidate.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SchemaValidate.java	23 Feb 2005 12:51:07 -0000	1.4
  +++ SchemaValidate.java	23 Feb 2005 13:04:16 -0000	1.5
  @@ -51,11 +51,15 @@
   
   public class SchemaValidate extends XMLValidateTask {
   
  +    /** map of all declared schemas; we catch and complain about redefinitions */
       private HashMap schemaLocations= new HashMap();
   
       /** full checking of a schema */
       private boolean fullChecking=true;
   
  +    /**
  +     * flag to disable DTD support. Best left enabled.
  +     */
       private boolean disableDTD=false;
   
       /**
  @@ -84,6 +88,10 @@
           setLenient(false);
       }
   
  +    /**
  +     * turn on XSD support in Xerces
  +     * @return
  +     */
       public boolean enableXercesSchemaValidation() {
           try {
               setFeature(XmlConstants.FEATURE_XSD,true);
  @@ -97,6 +105,10 @@
           return true;
       }
   
  +    /**
  +     * set nonamespace handling up for xerces or other parsers
  +     * @param property name of the property to set
  +     */
       private void setNoNamespaceSchemaProperty(String property) {
           String anonSchema = getNoNamespaceSchemaURL();
           if (anonSchema != null) {
  @@ -106,7 +118,7 @@
       }
   
       /**
  -     * JAXP12 schema attributes
  +     * set schema attributes in a JAXP12 engine
        * @see <A href="http://java.sun.com/xml/jaxp/change-requests-11.html">
        * JAXP 1.2 Approved CHANGES</A>
        * @return
  @@ -294,6 +306,15 @@
       }
   
       /**
  +     * handler called on successful file validation.
  +     *
  +     * @param fileProcessed number of files processed.
  +     */
  +    protected void onSuccessfulValidation(int fileProcessed) {
  +        log(fileProcessed + MESSAGE_FILES_VALIDATED,Project.MSG_VERBOSE);
  +    }
  +
  +    /**
        * representation of a schema location. This is a URI plus either a file or
        * a url
        */
  
  
  
  1.48      +10 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
  
  Index: XMLValidateTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- XMLValidateTask.java	22 Feb 2005 15:58:36 -0000	1.47
  +++ XMLValidateTask.java	23 Feb 2005 13:04:16 -0000	1.48
  @@ -96,6 +96,7 @@
       private final Vector propertyList = new Vector();
   
       private XMLCatalog xmlCatalog = new XMLCatalog();
  +    public static final String MESSAGE_FILES_VALIDATED = " file(s) have been successfully
validated.";
   
       /**
        * Specify how parser error are to be handled.
  @@ -312,7 +313,15 @@
                   fileProcessed++;
               }
           }
  -        log(fileProcessed + " file(s) have been successfully validated.");
  +        onSuccessfulValidation(fileProcessed);
  +    }
  +
  +    /**
  +     * handler called on successful file validation.
  +     * @param fileProcessed number of files processed. 
  +     */
  +    protected void onSuccessfulValidation(int fileProcessed) {
  +        log(fileProcessed + MESSAGE_FILES_VALIDATED);
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message