com.topologi.diffx
Class Main

java.lang.Object
  extended by com.topologi.diffx.Main

public final class Main
extends Object

Utility class to centralise the access to this API from the command line.

Version:
10 May 2010
Author:
Christophe Lauret

Method Summary
static void diff(InputStream xml1, InputStream xml2, OutputStream out)
          Compares the two specified xml files and prints the diff onto the given writer.
static void diff(NodeList xml1, NodeList xml2, Writer out, DiffXConfig config)
          Compares the two specified NodeLists and prints the diff onto the given writer.
static void diff(Node xml1, Node xml2, Writer out, DiffXConfig config)
          Compares the two specified XML nodes and prints the diff onto the given writer.
static void diff(Reader xml1, Reader xml2, Writer out)
          Compares the two specified xml files and prints the diff onto the given writer.
static void diff(Reader xml1, Reader xml2, Writer out, DiffXConfig config)
          Compares the two specified xml files and prints the diff onto the given writer.
static boolean equivalent(File xml1, File xml2)
          Returns true if the two specified files are XML equivalent by looking at the sequence SAX events reported an XML reader.
static boolean equivalent(InputStream xml1, InputStream xml2)
          Returns true if the two specified input streams are equivalent by looking at the sequence SAX events reported an XML reader.
static boolean equivalent(Reader xml1, Reader xml2)
          Returns true if the two specified readers are equivalent by looking at the sequence SAX events reported an XML reader.
static void main(String[] args)
          Main entry point from the command line.
static void usage()
          Displays the usage on the System.err console
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equivalent

public static boolean equivalent(File xml1,
                                 File xml2)
                          throws DiffXException,
                                 IOException
Returns true if the two specified files are XML equivalent by looking at the sequence SAX events reported an XML reader.

Parameters:
xml1 - The first XML stream to compare.
xml2 - The first XML stream to compare.
Returns:
true If the XML are considered equivalent; false otherwise.
Throws:
DiffXException - Should a Diff-X exception occur.
IOException - Should an I/O exception occur.

equivalent

public static boolean equivalent(InputStream xml1,
                                 InputStream xml2)
                          throws DiffXException,
                                 IOException
Returns true if the two specified input streams are equivalent by looking at the sequence SAX events reported an XML reader.

Parameters:
xml1 - The first XML stream to compare.
xml2 - The first XML stream to compare.
Returns:
true If the XML are considered equivalent; false otherwise.
Throws:
DiffXException - Should a Diff-X exception occur.
IOException - Should an I/O exception occur.

equivalent

public static boolean equivalent(Reader xml1,
                                 Reader xml2)
                          throws DiffXException,
                                 IOException
Returns true if the two specified readers are equivalent by looking at the sequence SAX events reported an XML reader.

Parameters:
xml1 - The first XML stream to compare.
xml2 - The first XML stream to compare.
Returns:
true If the XML are considered equivalent; false otherwise.
Throws:
DiffXException - If a DiffX exception is reported by the recorders.
IOException - Should an I/O exception occur.

diff

public static void diff(Node xml1,
                        Node xml2,
                        Writer out,
                        DiffXConfig config)
                 throws DiffXException,
                        IOException
Compares the two specified XML nodes and prints the diff onto the given writer.

Parameters:
xml1 - The first XML node to compare.
xml2 - The second XML node to compare.
out - Where the output goes.
config - The DiffX configuration to use.
Throws:
DiffXException - Should a Diff-X exception occur.
IOException - Should an I/O exception occur.

diff

public static void diff(NodeList xml1,
                        NodeList xml2,
                        Writer out,
                        DiffXConfig config)
                 throws DiffXException,
                        IOException
Compares the two specified NodeLists and prints the diff onto the given writer.

Only the first node in the node list is sequenced.

Parameters:
xml1 - The first XML node list to compare.
xml2 - The second XML node list to compare.
out - Where the output goes.
config - The DiffX configuration to use.
Throws:
DiffXException - Should a Diff-X exception occur.
IOException - Should an I/O exception occur.

diff

public static void diff(Reader xml1,
                        Reader xml2,
                        Writer out,
                        DiffXConfig config)
                 throws DiffXException,
                        IOException
Compares the two specified xml files and prints the diff onto the given writer.

Parameters:
xml1 - The first XML reader to compare.
xml2 - The first XML reader to compare.
out - Where the output goes.
config - The DiffX configuration to use.
Throws:
DiffXException - Should a Diff-X exception occur.
IOException - Should an I/O exception occur.

diff

public static void diff(Reader xml1,
                        Reader xml2,
                        Writer out)
                 throws DiffXException,
                        IOException
Compares the two specified xml files and prints the diff onto the given writer.

Parameters:
xml1 - The first XML reader to compare.
xml2 - The first XML reader to compare.
out - Where the output goes
Throws:
DiffXException - Should a Diff-X exception occur.
IOException - Should an I/O exception occur.

diff

public static void diff(InputStream xml1,
                        InputStream xml2,
                        OutputStream out)
                 throws DiffXException,
                        IOException
Compares the two specified xml files and prints the diff onto the given writer.

Parameters:
xml1 - The first XML input stream to compare.
xml2 - The first XML input stream to compare.
out - Where the output goes
Throws:
DiffXException - Should a Diff-X exception occur.
IOException - Should an I/O exception occur.

main

public static void main(String[] args)
                 throws Exception
Main entry point from the command line.

Parameters:
args - The command-line arguments
Throws:
Exception - If anything wrong happens.

usage

public static void usage()
Displays the usage on the System.err console