|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.xml.FOrayXDiff
public class FOrayXDiff
This class reads two or more XML streams and finds the first difference (if any) between them. This is not intended to be a general-purpose XML diff and compare tool. It is suitable in situations where some tranformation (like a pretty-print) has taken place and we wish to make sure that no significant changes were made to the document.
Field Summary | |
---|---|
static byte |
STATUS_COMMAND_LINE_ERROR
Command-line status constant indicating that the command line itself was not properly formed. |
static byte |
STATUS_DIFFERENCE_FOUND
Command-line status constant indicating that a substantive difference between the two inputs was detected. |
static byte |
STATUS_MALFORMED_URL
Command-line status constant indicating a malformed URL. |
static byte |
STATUS_PARSING_ERROR
Command-line status constant indicating a parsing error. |
static byte |
STATUS_SUCCESS
Command-line status constant indicating success. |
Constructor Summary | |
---|---|
FOrayXDiff(InputStream[] streams,
String catalog)
Constructor accepting InputStreams to compare. |
|
FOrayXDiff(URL[] urls,
String catalog)
Constructor accepting URLs to compare. |
Method Summary | |
---|---|
boolean |
equivalent()
Compares the XML streams passed or implicitly passed in the constructor, and returns true if the streams are equivalent, false if there is one or more differences. |
static String |
getEventDescription(int event)
Returns an event description matching the parsed event. |
org.apache.commons.logging.Log |
getLogger()
Returns the logger. |
static void |
main(String[] args)
Command-line interface for FOrayXDiff . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte STATUS_SUCCESS
public static final byte STATUS_COMMAND_LINE_ERROR
public static final byte STATUS_MALFORMED_URL
public static final byte STATUS_PARSING_ERROR
public static final byte STATUS_DIFFERENCE_FOUND
Constructor Detail |
---|
public FOrayXDiff(URL[] urls, String catalog) throws IOException, XMLStreamException
urls
- An array of URLs to be compared.catalog
- The location of a catalog file that should be used to find the DTD for this document.
IOException
- For errors opening the files.
XMLStreamException
- For errors parsing the files.For a constructor that takes any
{@link InputStream}.
public FOrayXDiff(InputStream[] streams, String catalog) throws XMLStreamException
streams
- An array of InputStreams to be compared.catalog
- The location of a catalog file that should be used to find the DTD for this document.
XMLStreamException
- For errors during the diff.For a constructor that takes {@link URL}s.
Method Detail |
---|
public boolean equivalent() throws IOException, XMLStreamException
IOException
- For errors reading the documents.
XMLStreamException
- For errors pulling events from the documents.public static String getEventDescription(int event)
event
- The parsed event.
event
.public org.apache.commons.logging.Log getLogger()
public static void main(String[] args)
FOrayXDiff
.
Design Note: We use files instead of URLs here to more easily integrate with desktop tools such as XML editors, which typically know how to pass parameters for local files, but not how to convert them to URLs. If URLs are needed, additional flags probably need to be added to the command-line interface to designate that.
Return status is one of:
args
- The following are valid command-line arguments:
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |