|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.uhn.hl7v2.util.EncodedMessageComparator
public class EncodedMessageComparator
Tools for testing message strings for semantic equivalence without assuming the correctness of parsers.
Constructor Summary | |
---|---|
EncodedMessageComparator()
|
Method Summary | |
---|---|
static boolean |
equivalent(java.lang.String message1,
java.lang.String message2)
Compares two HL7 messages to see if they are equivalent (in terms of their HL7 meaning). |
static void |
main(java.lang.String[] args)
Compares messages in two files |
static java.lang.String |
standardize(java.lang.String message)
Returns a "standardized" equivalent of the given message string. |
static java.lang.String |
standardizeER7(java.lang.String message)
Returns the shortest string that is semantically equivalent to a given ER7-encoded message string. |
static java.lang.String |
standardizeXML(java.lang.String message)
Returns a semantic equivalent of a given XML-encoded message in a default format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EncodedMessageComparator()
Method Detail |
---|
public static java.lang.String standardize(java.lang.String message) throws org.xml.sax.SAXException
message
- an XML-encoded or ER7-encoded message string
org.xml.sax.SAXException
public static java.lang.String standardizeER7(java.lang.String message)
public static java.lang.String standardizeXML(java.lang.String message) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public static boolean equivalent(java.lang.String message1, java.lang.String message2) throws HL7Exception
Compares two HL7 messages to see if they are equivalent (in terms of their HL7 meaning). Semantically irrelevant differences (e.g. spaces in an XML tag; extra field delimiters at the end of a segment; XML vs. ER7 encoding; XML attributes) are ignored. This check is performed without assuming the correctness of the HAPI parsers, and can therefore be used to test them. This is done by parsing a message, encoding it again, and comparing the result with this original.
If one message is in XML and the other in ER7, the former is converted to ER7 to perform the comparison. This process relies on the HAPI parsers. However, the parsed message is first encoded as XML and compared to the original, so that the integrity of the parser can be verified. An exception is thrown if this comparison is unsuccessful.
HL7Exception
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |