You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by lt...@apache.org on 2005/10/03 01:24:33 UTC

svn commit: r293181 - in /maven/maven-1/plugins/trunk/xdoc: plugin.jelly project.properties xdocs/reference/escapeXml.dtd xdocs/reference/xdocs.xml

Author: ltheussl
Date: Sun Oct  2 16:24:30 2005
New Revision: 293181

URL: http://svn.apache.org/viewcvs?rev=293181&view=rev
Log:
Allow validation of arbitrary xml files

Added:
    maven/maven-1/plugins/trunk/xdoc/xdocs/reference/escapeXml.dtd
Modified:
    maven/maven-1/plugins/trunk/xdoc/plugin.jelly
    maven/maven-1/plugins/trunk/xdoc/project.properties
    maven/maven-1/plugins/trunk/xdoc/xdocs/reference/xdocs.xml

Modified: maven/maven-1/plugins/trunk/xdoc/plugin.jelly
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/plugin.jelly?rev=293181&r1=293180&r2=293181&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/xdoc/plugin.jelly Sun Oct  2 16:24:30 2005
@@ -817,9 +817,20 @@
           </j:otherwise>
         </j:choose>
       <j:forEach var="file" items="${xmlFiles.iterator()}">
-        <plugin:validate-xml
-            schema="${plugin.resources}/dtd/maven-xdoc-${currentRelease}.dtd"
-            file="${file}"/>
+      <util:replace var="dtdFile" old=".xml" new=".dtd" value="${file}"/>
+      <util:replace var="xsdFile" old=".xml" new=".xsd" value="${file}"/>
+      <j:set var="schema" value="${plugin.resources}/dtd/maven-xdoc-${currentRelease}.dtd"/>
+      <util:available file="${dtdFile}">
+        <j:set var="schema" value="${dtdFile}"/>
+        <echo>Using ${dtdFile} for validation</echo>
+      </util:available>
+      <util:available file="${xsdFile}">
+        <j:set var="schema" value="${xsdFile}"/>
+        <echo>Using ${xsdFile} for validation</echo>
+      </util:available>
+      <plugin:validate-xml
+          schema="${schema}"
+          file="${file}"/>
       </j:forEach>
     </j:if>
 

Modified: maven/maven-1/plugins/trunk/xdoc/project.properties
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/project.properties?rev=293181&r1=293180&r2=293181&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/project.properties (original)
+++ maven/maven-1/plugins/trunk/xdoc/project.properties Sun Oct  2 16:24:30 2005
@@ -19,4 +19,4 @@
 # -------------------------------------------------------------------
 maven.junit.fork=yes
 maven.compile.encoding=UTF-8
-maven.xdoc.validate.exclude=changes.xml,reference/escapeXml.xml
+maven.xdoc.validate.exclude=changes.xml

Added: maven/maven-1/plugins/trunk/xdoc/xdocs/reference/escapeXml.dtd
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/xdocs/reference/escapeXml.dtd?rev=293181&view=auto
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/xdocs/reference/escapeXml.dtd (added)
+++ maven/maven-1/plugins/trunk/xdoc/xdocs/reference/escapeXml.dtd Sun Oct  2 16:24:30 2005
@@ -0,0 +1,3 @@
+  <!ELEMENT example (text)>
+  <!ATTLIST example name CDATA #IMPLIED>
+  <!ELEMENT text (#PCDATA)>

Modified: maven/maven-1/plugins/trunk/xdoc/xdocs/reference/xdocs.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/xdocs/reference/xdocs.xml?rev=293181&r1=293180&r2=293181&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/xdocs/reference/xdocs.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/xdocs/reference/xdocs.xml Sun Oct  2 16:24:30 2005
@@ -109,9 +109,12 @@
         </p>
         <source><escapeXml>&escapeXmlExample;</escapeXml></source>
         <p>
-          <strong>Note</strong> that currently it is not possible to validate
-          arbitrary xml files with the <code>xdoc:validate</code> goal.
-          You can use the <code>maven.xdoc.validate.exclude</code>
+          <strong>Note</strong> that it is possible to validate the included
+          xml file with the <code>xdoc:validate</code> goal even if it is not
+          a valid xdoc document (like in the example above). You just have to
+          provide a custom <code>.dtd</code> or <code>.xsd</code> schema file
+          with the same base name in the same directory. Otherwise,
+          you should use the <code>maven.xdoc.validate.exclude</code>
           property to exclude specific files from validation.
         </p>
       </subsection>



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