You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

xmlvalidate.html 3.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <html>
  2. <head>
  3. <title>XMLValidate Task</title>
  4. </head>
  5. <body>
  6. <h2><a name="xmlvalidate">XMLValidate</a></h2>
  7. <h3>Description</h3>
  8. <p>This task checks xml files are valid (or only well formed). The
  9. task uses the SAX2 parser implementation provided by JAXP by default
  10. (probably the one that is used by Ant itself), but one can specify any
  11. SAX1/2 parser if needed.</p>
  12. <h3>Parameters</h3>
  13. <table border="1" cellpadding="2" cellspacing="0">
  14. <tr>
  15. <td valign="top"><b>Attribute</b></td>
  16. <td valign="top"><b>Description</b></td>
  17. <td align="center" valign="top"><b>Required</b></td>
  18. </tr>
  19. <tr>
  20. <td valign="top">file</td>
  21. <td valign="top">the file(s) you want to check. (optionally can use an embedded fileset)</td>
  22. <td valign="top" align="center">No</td>
  23. </tr>
  24. <tr>
  25. <td valign="top">lenient</td>
  26. <td valign="top">
  27. if true, only check the xml document is well formed
  28. (ignored if the specified parser is as SAX1 parser)
  29. </td>
  30. <td valign="top" align="center">No</td>
  31. </tr>
  32. <tr>
  33. <td valign="top">classname</td>
  34. <td valign="top">the parser to use.</td>
  35. <td align="center" valign="top">No</td>
  36. </tr>
  37. <tr>
  38. <td valign="top">classpathref</td>
  39. <td valign="top">where to find the parser class. Optionally can use an embedded classpath element.</td>
  40. <td align="center" valign="top">No</td>
  41. </tr>
  42. <tr>
  43. <td valign="top">failonerror</td>
  44. <td valign="top">fails on a error if set to true (defaults to true).</td>
  45. <td align="center" valign="top">No</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">warn</td>
  49. <td valign="top">log parser warn events.</td>
  50. <td align="center" valign="top">No</td>
  51. </tr>
  52. </table>
  53. <h3><a name="nested">Nested Elements</a></h3>
  54. <h4>dtd</h4>
  55. &lt;dtd&gt; is used to specify different locations for DTD resolution.
  56. <table border="1" cellpadding="2" cellspacing="0">
  57. <tr>
  58. <td width="12%" valign="top"><b>Attribute</b></td>
  59. <td width="78%" valign="top"><b>Description</b></td>
  60. <td width="10%" valign="top"><b>Required</b></td>
  61. </tr>
  62. <tr>
  63. <td valign="top">publicId</td>
  64. <td valign="top">Public ID of the DTD to resolve</td>
  65. <td align="center" valign="top">Yes</td>
  66. </tr>
  67. <tr>
  68. <td valign="top">location</td>
  69. <td valign="top">Location of the DTD to use, which can be a file,
  70. a resource, or a URL</td>
  71. <td align="center" valign="top">Yes</td>
  72. </tr>
  73. </table>
  74. <h3>Examples</h3>
  75. <blockquote><pre>
  76. &lt;xmlvalidate file="toto.xml"/&gt;
  77. &lt;xmlvalidate failonerror="no" lenient="yes" warn="yes"
  78. classname="org.apache.xerces.parsers.SAXParser" &gt;
  79. classpath="lib/xerces.jar"&gt;
  80. &lt;fileset dir="src" includes="style/*.xsl"/&gt;
  81. &lt;/xmlvalidate&gt;
  82. &lt;xmlvalidate file="struts-config.xml" warn="false"&gt;
  83. &lt;dtd publicId="-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
  84. location="struts-config_1_0.dtd"/&gt;
  85. &lt;/xmlvalidate&gt;
  86. </pre></blockquote>
  87. <hr>
  88. <p align="center">Copyright &copy; 2001-2002 Apache Software Foundation. All rights
  89. Reserved.</p>
  90. </body>
  91. </html>