Browse Source

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.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277719 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 20 years ago
parent
commit
78ebf871dd
2 changed files with 32 additions and 2 deletions
  1. +22
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
  2. +10
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java

+ 22
- 1
src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java View File

@@ -51,11 +51,15 @@ import java.net.MalformedURLException;

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 @@ public class SchemaValidate extends XMLValidateTask {
setLenient(false);
}

/**
* turn on XSD support in Xerces
* @return
*/
public boolean enableXercesSchemaValidation() {
try {
setFeature(XmlConstants.FEATURE_XSD,true);
@@ -97,6 +105,10 @@ public class SchemaValidate extends XMLValidateTask {
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 @@ public class SchemaValidate extends XMLValidateTask {
}

/**
* 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
@@ -293,6 +305,15 @@ public class SchemaValidate extends XMLValidateTask {
}
}

/**
* 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


+ 10
- 1
src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java View File

@@ -96,6 +96,7 @@ public class XMLValidateTask extends Task {
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 @@ public class XMLValidateTask extends Task {
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);
}

/**


Loading…
Cancel
Save