Package javanet.staxutils.helpers
Class EventMatcher
java.lang.Object
javanet.staxutils.helpers.EventMatcher
Provides utility methods useful for comparing two
XMLEvent instances.
These methods compare only location/type-independent information, and thus don't
perform strict equality testing, which would include the event's location,
schema-type and dtd-type.- Version:
- $Revision: 1.2 $
- Author:
- Christian Niles
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleaneventsMatch(Attribute a, Attribute b) Compares twoAttributes, returningtrueif their names and values are the same.static booleaneventsMatch(Characters a, Characters b) Compares twoCharacterss.static booleaneventsMatch(Comment a, Comment b) Compares twoComments.static booleaneventsMatch(DTD a, DTD b) Compares twoDTDs.static booleanCompares twoEndDocuments.static booleaneventsMatch(EndElement a, EndElement b) Compares twoEndElements.static booleanCompares twoEntityDeclarations.static booleanCompares twoEntityReferences.static booleaneventsMatch(Namespace a, Namespace b) Compares twoNamespaces.static booleanCompares twoNotationDeclarations.static booleanCompares twoProcessingInstructions.static booleanCompares twoStartDocuments.static booleanCompares twoStartElements.static booleaneventsMatch(XMLEvent a, XMLEvent b) Compares twoXMLEventinstances.static booleanmatchAttributes(Iterator a, Iterator b) Iterates over two sets ofAttributes and determines if both contain matching attributes.static booleanmatchNamespaces(Iterator a, Iterator b) Iterates over two sets ofNamespaces and determines if both contain matching namespaces.
-
Method Details
-
eventsMatch
Compares twoXMLEventinstances. This method delegates actual matching to the appropriate overloaded method.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoAttributes, returningtrueif their names and values are the same.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoCharacterss. This method will returntrueonly if they have the same event type (XMLStreamConstants.CHARACTERS,XMLStreamConstants.CDATA, orXMLStreamConstants.SPACE), and their text content matches.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoComments. This method will returntrueonly if their text content matches.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoDTDs. This method will returntrueonly if their declarations are identical.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoEndDocuments. BecauseEndDocumentevents have no real state, two instances always match.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoEndElements. This method will returntrueonly if their names match.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoEntityDeclarations. This method will returntrueonly if the two events' names, replacement text, public IDs, system IDs, and notations are the same.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoEntityReferences. This method will returntrueonly if the two references have the same name, and their declarations also match.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoNamespaces. This method will returntrueonly if the two namespaces have identical prefixes and namespace URIs.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoNotationDeclarations. This method will returntrueonly if the two namespaces have identical names, public IDs, and system IDs.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoProcessingInstructions. This method will returntrueonly if the two events have identical targets and data.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoStartDocuments. This method will returntrueonly if the two events have identical encodings, versions, and have the same standalone setting.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
eventsMatch
Compares twoStartElements. This method will returntrueonly if the two events have identical names, attributes, and namespaces.- Parameters:
a- The first event.b- The second event.- Returns:
trueif the events match,falseotherwise.
-
matchAttributes
Iterates over two sets ofAttributes and determines if both contain matching attributes. -
matchNamespaces
Iterates over two sets ofNamespaces and determines if both contain matching namespaces.
-