Package com.topologi.diffx
Class Main
java.lang.Object
com.topologi.diffx.Main
Utility class to centralise the access to this API from the command line.
- Version:
- 10 May 2010
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voiddiff(EventSequence seq1, EventSequence seq2, Writer out, DiffXConfig config) Compares the two specified xml files and prints the diff onto the given writer.static voiddiff(InputStream xml1, InputStream xml2, OutputStream out) Compares the two specified xml files and prints the diff onto the given writer.static voidCompares the two specified xml files and prints the diff onto the given writer.static voiddiff(Reader xml1, Reader xml2, Writer out, DiffXConfig config) Compares the two specified xml files and prints the diff onto the given writer.static voiddiff(NodeList xml1, NodeList xml2, Writer out, DiffXConfig config) Compares the two specifiedNodeLists and prints the diff onto the given writer.static voiddiff(Node xml1, Node xml2, Writer out, DiffXConfig config) Compares the two specified XML nodes and prints the diff onto the given writer.static booleanequivalent(File xml1, File xml2) Returnstrueif the two specified files are XML equivalent by looking at the sequence SAX events reported an XML reader.static booleanequivalent(InputStream xml1, InputStream xml2) Returnstrueif the two specified input streams are equivalent by looking at the sequence SAX events reported an XML reader.static booleanequivalent(Reader xml1, Reader xml2) Returnstrueif the two specified readers are equivalent by looking at the sequence SAX events reported an XML reader.private static DiffXAlgorithmgetAlgorithm(String[] args, EventSequence seq1, EventSequence seq2) private static DiffXFormattergetFormatter(String[] args, Writer out) private static OutputStreamprivate static RecordergetRecorder(String[] args) private static TextGranularitygetTextGranularity(String[] args) private static WhiteSpaceProcessinggetWhiteSpaceProcessing(String[] args) static voidMain entry point from the command line.static voidusage()Displays the usage on the System.err console
-
Constructor Details
-
Main
private Main()Prevents creation of instances.
-
-
Method Details
-
equivalent
Returnstrueif 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:
trueIf the XML are considered equivalent;falseotherwise.- 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 Returnstrueif 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:
trueIf the XML are considered equivalent;falseotherwise.- Throws:
DiffXException- Should a Diff-X exception occur.IOException- Should an I/O exception occur.
-
equivalent
Returnstrueif 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:
trueIf the XML are considered equivalent;falseotherwise.- 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 specifiedNodeLists 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
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.
-
diff
private static void diff(EventSequence seq1, EventSequence seq2, Writer out, DiffXConfig config) throws DiffXException, IOException Compares the two specified xml files and prints the diff onto the given writer.- Parameters:
seq1- The first XML reader to compare.seq2- 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.
-
main
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 -
getRecorder
- Parameters:
args- The command line arguments.- Returns:
- The recorder to use.
-
getOutput
- Parameters:
args- The command line arguments.- Returns:
- The output to use.
- Throws:
FileNotFoundException- If the file does not exist.
-
getAlgorithm
- Parameters:
args- The command line arguments.seq1- The first sequence.seq2- The second sequence.- Returns:
- The algorithm to use.
-
getFormatter
- Parameters:
args- The command line arguments.out- The writer to use.- Returns:
- The formatter to use.
- Throws:
IOException- Should and I/O error occur
-
getWhiteSpaceProcessing
- Parameters:
args- The command line arguments.- Returns:
- The formatter to use.
- Throws:
IOException- Should and I/O error occur
-
getTextGranularity
- Parameters:
args- The command line arguments.- Returns:
- The formatter to use.
- Throws:
IOException- Should and I/O error occur
-