diff --git a/plugin/plugin.jelly b/plugin/plugin.jelly
index 7c030531..245091ef 100644
--- a/plugin/plugin.jelly
+++ b/plugin/plugin.jelly
@@ -31,6 +31,15 @@
xmlns:assert="assert">
+
+
+
+
+
+
@@ -55,8 +64,8 @@
-
-
+
+
diff --git a/plugin/project.xml b/plugin/project.xml
index 8334b79b..5a9c9d1f 100644
--- a/plugin/project.xml
+++ b/plugin/project.xml
@@ -115,6 +115,14 @@
Developer
+
+ Lukas Theussl
+ ltheussl
+ ltheussl@apache.org
+
+ Developer
+
+
@@ -134,6 +142,11 @@
commons-jelly-tags-interaction
1.0
+
+ commons-logging
+ commons-logging
+ 1.0.3
+
jdom
jdom
@@ -160,5 +173,25 @@
2.4.0
http://xml.apache.org/xerces2-j/
+
+ msv
+ msv
+ 20050913
+
+
+ msv
+ isorelax
+ 20050913
+
+
+ msv
+ relaxngDatatype
+ 20050913
+
+
+ msv
+ xsdlib
+ 20050913
+
diff --git a/plugin/src/main/org/apache/maven/JaxpMsvBean.java b/plugin/src/main/org/apache/maven/JaxpMsvBean.java
new file mode 100644
index 00000000..8776d6e8
--- /dev/null
+++ b/plugin/src/main/org/apache/maven/JaxpMsvBean.java
@@ -0,0 +1,136 @@
+package org.apache.maven;
+
+/* ====================================================================
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+
+import com.sun.msv.verifier.jaxp.SAXParserFactoryImpl;
+
+import java.io.File;
+
+import javax.xml.parsers.*;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * JaxpMsvBean Bean: Uses JAXP implementation of MSV.
+ *
+ * @author Lukas Theussl
+ */
+public class JaxpMsvBean
+{
+ //~ Instance fields ------------------------------------------------------
+
+ /** The schema to use. */
+ private String schema;
+
+ /** The file to validate. */
+ private String file;
+
+ /** For debug output. */
+ private Log log = LogFactory.getLog(JaxpMsvBean.class);
+
+
+ //~ Methods --------------------------------------------------------------
+
+ /**
+ * Performs validation.
+ */
+ public void validate() throws Exception
+ {
+ SAXParserFactory factory =
+ new SAXParserFactoryImpl(new File(schema));
+ factory.setNamespaceAware(true);
+ SAXParser parser = factory.newSAXParser();
+ parser.parse(new File(file), new DefaultHandler()
+ {
+ boolean isValid = true;
+ public void warning(SAXParseException e) throws SAXException
+ {
+ log.warn(e);
+ }
+ public void error(SAXParseException e) throws SAXException
+ {
+ log.error(e);
+ isValid = false;
+ }
+ public void fatalError(SAXParseException e) throws SAXException
+ {
+ log.error(e);
+ isValid = false;
+ }
+ public void endDocument()
+ {
+ if(isValid)
+ {
+ log.info(file + " verified: OK");
+ } else {
+ log.info("WARNING: " + file + " is NOT valid");
+ }
+ }
+ });
+ }
+
+ /**
+ * Sets the schema.
+ *
+ * @param newSchema The schema to set
+ */
+ public void setSchema(String newSchema)
+ {
+ this.schema = newSchema;
+ }
+
+ /**
+ * Sets the file.
+ *
+ * @param newFile The file to set
+ */
+ public void setFile(String newFile)
+ {
+ this.file = newFile;
+ }
+
+ /**
+ * Gets the schema.
+ *
+ * @return The schema
+ */
+ public String getSchema()
+ {
+ return schema;
+ }
+
+ /**
+ * Gets the file.
+ *
+ * @return The file
+ */
+ public String getFile()
+ {
+ return file;
+ }
+
+
+
+}
diff --git a/plugin/xdocs/changes.xml b/plugin/xdocs/changes.xml
index 82d85766..e0e8b07e 100644
--- a/plugin/xdocs/changes.xml
+++ b/plugin/xdocs/changes.xml
@@ -24,6 +24,7 @@
+ new plugin:validate-xml tag to validate xml documents against a schema.
new assert:assertPluginAvailable tag to check if a minimal release of a plugin is present.
diff --git a/plugin/xdocs/goals.xml b/plugin/xdocs/goals.xml
index 49515c47..d348c0ab 100644
--- a/plugin/xdocs/goals.xml
+++ b/plugin/xdocs/goals.xml
@@ -27,7 +27,7 @@
plugin
- Build and install a plugin
+ Build a plugin jar
plugin:download
diff --git a/plugin/xdocs/tags.xml b/plugin/xdocs/tags.xml
index 6049e8c2..f3858a5a 100644
--- a/plugin/xdocs/tags.xml
+++ b/plugin/xdocs/tags.xml
@@ -31,6 +31,7 @@
- uninstall
- clearCache
+ - validate-xml
assert
@@ -39,7 +40,7 @@
assertFileContains
assertFileNotFound
assertEquals
- available
+ assertPluginAvailable
@@ -71,6 +72,24 @@
There are no attributes for this tag
+
+
+ A tag to validate an arbitrary xml document against a schema.
+
+
+ | Attribute | Optional? | Description |
+
+ | schema |
+ No |
+ The schema file to use. |
+
+
+ | file |
+ No |
+ The file to validate. |
+
+
+