alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Ant example source code file (schemavalidate.xml)

This example Ant source code file (schemavalidate.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Ant tags/keywords

The schemavalidate.xml source code

<project name="validate" default="default" basedir=".">


  <property name="doc.xsd" location="xml/doc.xsd"/>
  <property name="doc-in-ns.xsd" location="xml/doc-in-ns.xsd"/>
  <property name="namespace" value="http://apache.org/ant/doc/" />
  
  <property name="endpiece-ns-no-location.xml" 
    location="xml/endpiece-ns-no-location.xml"/>

  <target name="testNoNamespace">
    <schemavalidate
      noNamespaceFile="${doc.xsd}"
      file="xml/endpiece-noSchema.xml">
    </schemavalidate>
  </target>

  <target name="testNSMapping">
    <schemavalidate
      file="${endpiece-ns-no-location.xml}">
      <schema namespace="${namespace}" file="${doc-in-ns.xsd}" />
      <schema namespace="http://apache.org/ant/2" 
        url="http://ant.apache.org/" />
    </schemavalidate>
  </target>

  <target name="testNoEmptySchemaNamespace">
    <schemavalidate
      file="${endpiece-ns-no-location.xml}">
      <schema namespace="" file="${doc-in-ns.xsd}" />
    </schemavalidate>
  </target>

  <target name="testNoEmptySchemaLocation">
    <schemavalidate
      file="${endpiece-ns-no-location.xml}">
      <schema namespace="${namespace}" />
    </schemavalidate>
  </target>
  
  <target name="testNoFile">
    <schemavalidate
      file="${endpiece-ns-no-location.xml}">
      <schema namespace="${namespace}" file="${namespace}" />
    </schemavalidate>
  </target>  
  
  <target name="testNoDoubleSchemaLocation">
    <schemavalidate
      file="${endpiece-ns-no-location.xml}">
      <schema namespace="${namespace}" file="${doc-in-ns.xsd}" url="${namespace}"/>
    </schemavalidate>
  </target>

  <target name="testNoDuplicateSchema">
    <schemavalidate
      file="${endpiece-ns-no-location.xml}">
      <schema namespace="${namespace}" file="${doc-in-ns.xsd}" />
      <schema namespace="${namespace}" 
        url="http://ant.apache.org/" />
    </schemavalidate>
  </target>  

  <target name="testEqualsSchemasOK">
    <schemavalidate
      file="${endpiece-ns-no-location.xml}">
      <schema namespace="${namespace}" file="${doc-in-ns.xsd}" />
      <schema namespace="${namespace}" file="${doc-in-ns.xsd}" />
    </schemavalidate>
  </target>  
  
  <target name="testFileset">
    <schemavalidate noNamespaceFile="${doc.xsd}"
      >
      <schema namespace="${namespace}" file="${doc-in-ns.xsd}" />
      <fileset dir="xml" 
        includes="endpiece.xml, endpiece-ns-no-location.xml, endpiece-no-schema.xml" />
    </schemavalidate>
  </target>  
  
  
  <target name="default" depends="testNoNamespace,testNSMapping" />
</project>

Other Ant examples (source code examples)

Here is a short list of links related to this Ant schemavalidate.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.