Java Doc for XMLValidateTask.java in  » Build » ANT » org » apache » tools » ant » taskdefs » optional » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » ANT » org.apache.tools.ant.taskdefs.optional 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.tools.ant.Task
   org.apache.tools.ant.taskdefs.optional.XMLValidateTask

All known Subclasses:   org.apache.tools.ant.taskdefs.optional.SchemaValidate,
XMLValidateTask
public class XMLValidateTask extends Task (Code)
Checks XML files are valid (or only well formed). The task uses the SAX2 parser implementation provided by JAXP by default (probably the one that is used by Ant itself), but one can specify any SAX1/2 parser if needed.

Inner Class :protected class ValidatorErrorHandler implements ErrorHandler
Inner Class :public static class Attribute
Inner Class :final public static class Property

Field Summary
final protected static  StringINIT_FAILED_MSG
    
final public static  StringMESSAGE_FILES_VALIDATED
    
protected  Pathclasspath
    
protected  ValidatorErrorHandlererrorHandler
    
protected  booleanfailOnError
    
protected  Filefile
    
protected  Vectorfilesets
    
protected  booleanlenient
    
protected  StringreaderClassName
    
protected  booleanwarn
    
protected  XMLReaderxmlReader
     the parser is viewed as a SAX2 XMLReader.


Method Summary
public  voidaddConfiguredXMLCatalog(XMLCatalog catalog)
     add an XMLCatalog as a nested element; optional.
public  voidaddFileset(FileSet set)
    
public  AttributecreateAttribute()
     Add an attribute nested element.
public  PathcreateClasspath()
    
public  DTDLocationcreateDTD()
     Create a DTD location record; optional. This stores the location of a DTD.
protected  XMLReadercreateDefaultReader()
     create a reader if the use of the class did not specify another one.
public  PropertycreateProperty()
     Creates a property.
protected  XMLReadercreateXmlReader()
     create the XML reader.
protected  booleandoValidate(File afile)
     parse the file
Parameters:
  afile - the file to validate.
public  voidexecute()
    
protected  EntityResolvergetEntityResolver()
    
protected  XMLReadergetXmlReader()
     get the XML reader.
public  voidinit()
     Called by the project to let the task initialize properly.
protected  voidinitValidator()
    
protected  booleanisSax1Parser()
     test that returns true if we are using a SAX1 parser.
protected  voidonSuccessfulValidation(int fileProcessed)
     handler called on successful file validation.
public  voidsetClassName(String className)
     Specify the class name of the SAX parser to be used.
public  voidsetClasspath(Path classpath)
    
public  voidsetClasspathRef(Reference r)
     Where to find the parser class; optional.
public  voidsetFailOnError(boolean fail)
     Specify how parser error are to be handled.
protected  voidsetFeature(String feature, boolean value)
     Set a feature on the parser.
public  voidsetFile(File file)
     specify the file to be checked; optional.
public  voidsetLenient(boolean bool)
     Specify whether the parser should be validating.
protected  voidsetProperty(String name, String value)
     Sets a property.
public  voidsetWarn(boolean bool)
     Specify how parser error are to be handled.

Field Detail
INIT_FAILED_MSG
final protected static String INIT_FAILED_MSG(Code)



MESSAGE_FILES_VALIDATED
final public static String MESSAGE_FILES_VALIDATED(Code)
Message for sucessfull validation



classpath
protected Path classpath(Code)



errorHandler
protected ValidatorErrorHandler errorHandler(Code)



failOnError
protected boolean failOnError(Code)



file
protected File file(Code)
file to be validated



filesets
protected Vector filesets(Code)
sets of file to be validated



lenient
protected boolean lenient(Code)



readerClassName
protected String readerClassName(Code)



warn
protected boolean warn(Code)



xmlReader
protected XMLReader xmlReader(Code)
the parser is viewed as a SAX2 XMLReader. If a SAX1 parser is specified, it's wrapped in an adapter that make it behave as a XMLReader. a more 'standard' way of doing this would be to use the JAXP1.1 SAXParser interface.





Method Detail
addConfiguredXMLCatalog
public void addConfiguredXMLCatalog(XMLCatalog catalog)(Code)
add an XMLCatalog as a nested element; optional.
Parameters:
  catalog - XMLCatalog to use



addFileset
public void addFileset(FileSet set)(Code)
specify a set of file to be checked
Parameters:
  set - the fileset to check



createAttribute
public Attribute createAttribute()(Code)
Add an attribute nested element. This is used for setting arbitrary features of the SAX parser. Valid attributes include attribute created
since:
   ant1.6



createClasspath
public Path createClasspath()(Code)

See Also:   XMLValidateTask.setClasspath the classpath created



createDTD
public DTDLocation createDTD()(Code)
Create a DTD location record; optional. This stores the location of a DTD. The DTD is identified by its public Id. created DTD location



createDefaultReader
protected XMLReader createDefaultReader()(Code)
create a reader if the use of the class did not specify another one. If a BuildException is thrown, the caller may revert to an alternate reader. a new reader.
throws:
  BuildException - if something went wrong



createProperty
public Property createProperty()(Code)
Creates a property. a property.
since:
   ant 1.6.2



createXmlReader
protected XMLReader createXmlReader()(Code)
create the XML reader. This is one by instantiating anything specified by XMLValidateTask.readerClassName , falling back to a default reader if not. If the returned reader is an instance of ParserAdapter then we have created and wrapped a SAX1 parser. the new XMLReader.



doValidate
protected boolean doValidate(File afile)(Code)
parse the file
Parameters:
  afile - the file to validate. true if the file validates.



execute
public void execute() throws BuildException(Code)
execute the task
throws:
  BuildException - if failonerror is true and an error happens



getEntityResolver
protected EntityResolver getEntityResolver()(Code)
accessor to the xmlCatalog used in the task xmlCatalog reference



getXmlReader
protected XMLReader getXmlReader()(Code)
get the XML reader. Non-null only after XMLValidateTask.initValidator() . If the reader is an instance of ParserAdapter then the parser is a SAX1 parser, and you cannot call XMLValidateTask.setFeature(String,boolean) or XMLValidateTask.setProperty(String,String) on it. the XML reader or null.



init
public void init() throws BuildException(Code)
Called by the project to let the task initialize properly.
exception:
  BuildException - if something goes wrong with the build



initValidator
protected void initValidator()(Code)
init the parser : load the parser class, and set features if necessary It is only after this that the reader is valid
throws:
  BuildException - if something went wrong



isSax1Parser
protected boolean isSax1Parser()(Code)
test that returns true if we are using a SAX1 parser. true when a SAX1 parser is in use



onSuccessfulValidation
protected void onSuccessfulValidation(int fileProcessed)(Code)
handler called on successful file validation.
Parameters:
  fileProcessed - number of files processed.



setClassName
public void setClassName(String className)(Code)
Specify the class name of the SAX parser to be used. (optional)
Parameters:
  className - should be an implementation of SAX2org.xml.sax.XMLReader or SAX2 org.xml.sax.Parser.

if className is an implementation oforg.xml.sax.Parser, XMLValidateTask.setLenient(boolean),will be ignored.

if not set, the default will be used.
See Also:   org.xml.sax.XMLReader
See Also:   org.xml.sax.Parser




setClasspath
public void setClasspath(Path classpath)(Code)
Specify the classpath to be searched to load the parser (optional)
Parameters:
  classpath - the classpath to load the parser



setClasspathRef
public void setClasspathRef(Reference r)(Code)
Where to find the parser class; optional.
See Also:   XMLValidateTask.setClasspath
Parameters:
  r - reference to a classpath defined elsewhere



setFailOnError
public void setFailOnError(boolean fail)(Code)
Specify how parser error are to be handled. Optional, default is true.

If set to true (default), throw a buildException if the parser yields an error.
Parameters:
  fail - if set to false do not fail on error




setFeature
protected void setFeature(String feature, boolean value) throws BuildException(Code)
Set a feature on the parser.
Parameters:
  feature - the name of the feature to set
Parameters:
  value - the value of the feature
throws:
  BuildException - if the feature was not supported



setFile
public void setFile(File file)(Code)
specify the file to be checked; optional.
Parameters:
  file - the file to be checked



setLenient
public void setLenient(boolean bool)(Code)
Specify whether the parser should be validating. Default is true.

If set to false, the validation will fail only if the parsed document is not well formed XML.

this option is ignored if the specified class with XMLValidateTask.setClassName(String) is not a SAX2 XMLReader.
Parameters:
  bool - if set to false only fail on malformed XML




setProperty
protected void setProperty(String name, String value) throws BuildException(Code)
Sets a property.
Parameters:
  name - a property name
Parameters:
  value - a property value.
throws:
  BuildException - if an error occurs.
throws:
  BuildException - if the property was not supported



setWarn
public void setWarn(boolean bool)(Code)
Specify how parser error are to be handled.

If set to true (default), log a warn message for each SAX warn event.
Parameters:
  bool - if set to false do not send warnings




Fields inherited from org.apache.tools.ant.Task
protected Target target(Code)(Java Doc)
protected String taskName(Code)(Java Doc)
protected String taskType(Code)(Java Doc)
protected RuntimeConfigurable wrapper(Code)(Java Doc)

Methods inherited from org.apache.tools.ant.Task
final public void bindToOwner(Task owner)(Code)(Java Doc)
public void execute() throws BuildException(Code)(Java Doc)
public Target getOwningTarget()(Code)(Java Doc)
public RuntimeConfigurable getRuntimeConfigurableWrapper()(Code)(Java Doc)
public String getTaskName()(Code)(Java Doc)
public String getTaskType()(Code)(Java Doc)
protected RuntimeConfigurable getWrapper()(Code)(Java Doc)
protected void handleErrorFlush(String output)(Code)(Java Doc)
protected void handleErrorOutput(String output)(Code)(Java Doc)
protected void handleFlush(String output)(Code)(Java Doc)
protected int handleInput(byte[] buffer, int offset, int length) throws IOException(Code)(Java Doc)
protected void handleOutput(String output)(Code)(Java Doc)
public void init() throws BuildException(Code)(Java Doc)
final protected boolean isInvalid()(Code)(Java Doc)
public void log(String msg)(Code)(Java Doc)
public void log(String msg, int msgLevel)(Code)(Java Doc)
public void log(Throwable t, int msgLevel)(Code)(Java Doc)
public void log(String msg, Throwable t, int msgLevel)(Code)(Java Doc)
public void maybeConfigure() throws BuildException(Code)(Java Doc)
final public void perform()(Code)(Java Doc)
public void reconfigure()(Code)(Java Doc)
public void setOwningTarget(Target target)(Code)(Java Doc)
public void setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper)(Code)(Java Doc)
public void setTaskName(String name)(Code)(Java Doc)
public void setTaskType(String type)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.