Package javanet.staxutils.helpers
Class EventMatcher
- java.lang.Object
-
- javanet.staxutils.helpers.EventMatcher
-
public final class EventMatcher extends Object
Provides utility methods useful for comparing twoXMLEventinstances. 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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 booleaneventsMatch(EndDocument a, EndDocument b)Compares twoEndDocuments.static booleaneventsMatch(EndElement a, EndElement b)Compares twoEndElements.static booleaneventsMatch(EntityDeclaration a, EntityDeclaration b)Compares twoEntityDeclarations.static booleaneventsMatch(EntityReference a, EntityReference b)Compares twoEntityReferences.static booleaneventsMatch(Namespace a, Namespace b)Compares twoNamespaces.static booleaneventsMatch(NotationDeclaration a, NotationDeclaration b)Compares twoNotationDeclarations.static booleaneventsMatch(ProcessingInstruction a, ProcessingInstruction b)Compares twoProcessingInstructions.static booleaneventsMatch(StartDocument a, StartDocument b)Compares twoStartDocuments.static booleaneventsMatch(StartElement a, StartElement b)Compares 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 Detail
-
eventsMatch
public static boolean eventsMatch(XMLEvent a, XMLEvent b)
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
public static boolean eventsMatch(Attribute a, Attribute b)
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
public static boolean eventsMatch(Characters a, Characters b)
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
public static boolean eventsMatch(Comment a, Comment b)
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
public static boolean eventsMatch(DTD a, DTD b)
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
public static boolean eventsMatch(EndDocument a, EndDocument b)
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
public static boolean eventsMatch(EndElement a, EndElement b)
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
public static boolean eventsMatch(EntityDeclaration a, EntityDeclaration b)
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
public static boolean eventsMatch(EntityReference a, EntityReference b)
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
public static boolean eventsMatch(Namespace a, Namespace b)
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
public static boolean eventsMatch(NotationDeclaration a, NotationDeclaration b)
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
public static boolean eventsMatch(ProcessingInstruction a, ProcessingInstruction b)
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
public static boolean eventsMatch(StartDocument a, StartDocument b)
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
public static boolean eventsMatch(StartElement a, StartElement b)
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
public static boolean matchAttributes(Iterator a, Iterator b)
Iterates over two sets ofAttributes and determines if both contain matching attributes.
-
-