validate.xml 3.72 KB
<?xml version="1.0"?>
<project basedir=".">
	
	<property name="seam.dir" value="${basedir}" />

	<property name="seam.schemaLocations" value="
	http://jboss.com/products/seam/async ${src.schema.dir}/async-${schema.version}.xsd 
	http://jboss.com/products/seam/bpm ${src.schema.dir}/bpm-${schema.version}.xsd 
	http://jboss.com/products/seam/components ${src.schema.dir}/components-${schema.version}.xsd 
	http://jboss.com/products/seam/core ${src.schema.dir}/core-${schema.version}.xsd 
	http://jboss.com/products/seam/drools ${src.schema.dir}/drools-${schema.version}.xsd 
	http://jboss.com/products/seam/framework ${src.schema.dir}/framework-${schema.version}.xsd 
	http://jboss.com/products/seam/international ${src.schema.dir}/international-${schema.version}.xsd 
	http://jboss.com/products/seam/jms ${src.schema.dir}/jms-${schema.version}.xsd 
	http://jboss.com/products/seam/mail ${src.schema.dir}/mail-${schema.version}.xsd 
	http://jboss.com/products/seam/navigation ${src.schema.dir}/navigation-${schema.version}.xsd 
	http://jboss.com/products/seam/pageflow ${src.schema.dir}/pageflow-${schema.version}.xsd 
	http://jboss.com/products/seam/pages ${src.schema.dir}/pages-${schema.version}.xsd 
	http://jboss.com/products/seam/pdf ${seam.dir}/src/pdf/org/jboss/seam/pdf/pdf-${schema.version}.xsd 
	http://jboss.com/products/seam/persistence ${src.schema.dir}/persistence-${schema.version}.xsd 
	http://jboss.com/products/seam/remoting ${src.schema.dir}/remoting-${schema.version}.xsd 
	http://jboss.com/products/seam/security ${src.schema.dir}/security-${schema.version}.xsd 
	http://jboss.com/products/seam/theme ${src.schema.dir}/theme-${schema.version}.xsd 
	http://jboss.com/products/seam/transaction ${src.schema.dir}/transaction-${schema.version}.xsd 
	http://jboss.com/products/seam/web ${src.schema.dir}/web-${schema.version}.xsd " />

	<taskdef name="xmlvalidate.task" classname="org.apache.tools.ant.taskdefs.optional.XMLValidateTask">
		<classpath>
			<fileset dir="${seam.dir}/lib" />
		</classpath>
	</taskdef>

	<fileset id="validate.resources" dir="${validate.resources.dir}">
		<include name="**/META-INF/application.xml" />
		<include name="**/META-INF/ejb-jar.xml" />
		<include name="**/META-INF/persistence.xml" />
		<include name="**/META-INF/jboss-app.xml" />
		<include name="**/META-INF/orm.xml" />
		<include name="**/WEB-INF/components.xml" />
		<include name="**/WEB-INF/pages.xml" />
		<include name="**/WEB-INF/faces-config.xml" />
		<include name="**/WEB-INF/web.xml" />
		<include name="**/WEB-INF/jboss-web.xml" />
		<include name="**/${example.ds}" />
		<include name="**/hibernate.cfg.xml" />
		<include name="**/*.jpdl.xml" />
		<exclude name="**/.gpd.*.jpdl.xml" />
	</fileset>

	<target name="validateConfiguration" description="Validate XML Configuration Files">
		<validateConfiguration>
			<fileset refid="validate.resources" />
		</validateConfiguration>
	</target>

	<presetdef name="validateConfiguration" >
		<xmlvalidate.task classname="org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser">
			<attribute name="http://xml.org/sax/features/validation" value="true" />
			<attribute name="http://apache.org/xml/features/validation/schema" value="true" />
			<attribute name="http://xml.org/sax/features/namespaces" value="true" />
			<property name="http://apache.org/xml/properties/schema/external-schemaLocation" value="${seam.schemaLocations}" />
			<xmlcatalog>
				<dtd publicId="-//JBoss/Seam Component Configuration DTD 2.0//EN" location="${src.schema.dir}/components-${schema.version}.dtd" />
				<dtd publicId="-//JBoss/Seam Pages Configuration DTD 2.0//EN" location="${src.schema.dir}/pages-${schema.version}.dtd" />
			</xmlcatalog>
			<classpath>
				<fileset dir="${seam.dir}/lib" />
			</classpath>
		</xmlvalidate.task>
	</presetdef>
</project>