XML Document Validator - XDV

XDV

XDV is open source, Java implementation of CLiXML language - a XML validation schema based on first order logic and XPath

Tomasz Kokoszka

Author personal site:
sites.google.com/site/tkokoszka

Recent site activity

Source code

This section describes how to get project source code and build it.

Location

Project source code is stored in a SVN repository at SourceForge.net

Structure

  • build/ - generated automatically during the build and test time, target directory for all build and test results.
    • java/        compiled Java code, generated by: ant compile
    • javadoc/     generated JavaDoc, generated by: ant javadoc
    • javatests/   compiled Java test code, generated by: ant compile-test
    • xdv-1.0.jar  XDV jar file, generated by: ant xdv.jar
  • doc/ - documentation.
    • javadoc/     additional resources for JavaDoc generation (CSS, images etc).
  • examples/ - examples of how to use the XDV library.
    • clixml-rules/   rules expressed in CLiXML.
    • java/           Java sample code on how to use various functionality offered by the XDV library.
  • java/ - Java source code.
  • javatests/ - Java tests source code.
  • lib/ - default location for external dependencies, see section "External dependencies" bellow.
  • schema/ - XML-Schema definitions.
  • / - build script.
    • build.properties  build parameters (directory names, etc).
    • build.xml         ANT build script.

External dependencies

Project distinguishes three types of dependencies:
  1. Build - required to build the source code.
  2. Test - required to complie and run tests.
  3. Run - required to run code that uses the XDV library.
List of external dependencies that are not distributed with the project and have to be downloaded separately:
  1. JRE - Java SE Runtime Environment 1.6 or above.
  2. JDK - Java SE Development Kit Java 1.6 or above.
  3. ANT 1.7 or above.
  4. Jaxen 1.1.1 or above.
    • Type: build, test, run - required at run time only if XDV Jaxen XPath module is being used.
    • Download: http://jaxen.codehaus.org/releases.html
    • For build and test time copy Jaxen JAR file to the lib/ directory.
  5. Saxon 6.5.5.
    • Type: build, test, run - required at run time only if XDV Saxon6 XPath module is being used.
    • Download: http://saxon.sourceforge.net/#F6.5.5
    • For build and test time copy Saxon6 JAR file to the lib/ directory.
  6. JUnit 4.0 or above.

Building the project

All external build time dependencies have to be available in order to build the XDV project - see section "External dependencies" above.
Source code is distributed with an ANT build script that automates the build and test process. To build the XDV library simply execute command  ant in the project main directory. The result (a JAR file) will be generated and placed in the build/ directory.

List of all build commands:
  • ant -p        - lists all available ant tasks
  • ant compile   - compile Java code into build/java/
  • ant compile-test  - compile Java tests into build/javatests/
  • ant javatests - execute all Java tests and print overall result
  • ant xdv.jar   - build the XDV library (default build task)
  • ant javadoc   - generate JavaDoc into build/javadoc/

Build results

Build results are available in the build/ directory. The redistributable component is a JAR file called xdv-{version}.jar

Tests

Unit tests and functional tests are written using JUnit4 and are stored in javatests/ directory.
Command ant javatests takes all public Java classes with suffix Test from the javatests/ directory, executes them and prints a brief result.

Versioning, code trunks, releases

SVN trunks:
  • trunk - the main trunk of the code, represents the most recent version.
So far there are no other branches as project is still under development.

Java coding guidelines

  1. File header:
    // XML Document Validator. Apache License 2.0
  2. Formatting:
    1. Use only spaces - no tabs.
    2. Default indentation is two (2) spaces.
    3. Use four (4) spaces indentation if the line is a continuation of the previous one.
    4. Max line length is 100 characters.
  3. JavaDoc:
    1. Author tag should be provided in a form:
      @author {user first and last name} ({SourceForge-user-login})
    2. One blank line should be put before @param section.
    3. Use {@code ...} instead of <code>...</code>
    4. Write JavaDoc for non trivial parts of the code.
  4. Coding:
    1. Methods' parameters are not null by default. JavaDoc should say 'Can be null' if a method accepts null for a given parameter.
    2. Methods do not return null objects by default. JavaDoc should say 'Can be null' if a method can return a null object.
    3. Methods do not modify their parameters by default. JavaDoc should say 'Modified in place' if a parameter can be modified.
    4. Objects, methods and attributes should have least required access level.
      In particular do not make a class public if it is used used only within a package.
    5. The code has to compile without warning.
  5. Imports:
    1. Do to extend static import but import always everything:
      import static org.junit.Assert.*
  6. Tests:
    1. Every non trival functionality has to be tested.
    2. Test class to execute has to have Test suffix.
    3. Code in the repository should always compile correctly and should always pass all the tests.
      One should make sure those assumptions are valid before submitting any changes