## javanet.staxutils.helpers
Class EventMatcher

    java.lang.Object
      javanet.staxutils.helpers.EventMatcher

    public final class EventMatcher

extends Object

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
`static boolean` `eventsMatch(Attribute a, Attribute b)` Compares two `Attribute`s, returning `true` if their names and values are the same.
`static boolean` `eventsMatch(Characters a, Characters b)` Compares two `Characters`s.
`static boolean` `eventsMatch(Comment a, Comment b)` Compares two `Comment`s.
`static boolean` `eventsMatch(DTD a, DTD b)` Compares two `DTD`s.
`static boolean` `eventsMatch(EndDocument a, EndDocument b)` Compares two `EndDocument`s.
`static boolean` `eventsMatch(EndElement a, EndElement b)` Compares two `EndElement`s.
`static boolean` `eventsMatch(EntityDeclaration a, EntityDeclaration b)` Compares two `EntityDeclaration`s.
`static boolean` `eventsMatch(EntityReference a, EntityReference b)` Compares two `EntityReference`s.
`static boolean` `eventsMatch(Namespace a, Namespace b)` Compares two `Namespace`s.
`static boolean` `eventsMatch(NotationDeclaration a, NotationDeclaration b)` Compares two `NotationDeclaration`s.
`static boolean` `eventsMatch(ProcessingInstruction a, ProcessingInstruction b)` Compares two `ProcessingInstruction`s.
`static boolean` `eventsMatch(StartDocument a, StartDocument b)` Compares two `StartDocument`s.
`static boolean` `eventsMatch(StartElement a, StartElement b)` Compares two `StartElement`s.
`static boolean` `eventsMatch(XMLEvent a, XMLEvent b)` Compares two `XMLEvent` instances.
`static boolean` `matchAttributes(Iterator a, Iterator b)` Iterates over two sets of `Attribute`s and determines if both contain matching attributes.
`static boolean` `matchNamespaces(Iterator a, Iterator b)` Iterates over two sets of `Namespace`s and determines if both contain matching namespaces.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### eventsMatch

    public static boolean eventsMatch(XMLEvent a,
                                      XMLEvent b)

  Compares two `XMLEvent` instances. This method delegates actual matching to the appropriate overloaded method.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(Attribute a,
                                      Attribute b)

  Compares two `Attribute`s, returning `true` if their names and values are the same.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(Characters a,
                                      Characters b)

  Compares two `Characters`s. This method will return `true` only if they have the same event type (`XMLStreamConstants.CHARACTERS`, `XMLStreamConstants.CDATA`, or `XMLStreamConstants.SPACE`), and their text content matches.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(Comment a,
                                      Comment b)

  Compares two `Comment`s. This method will return `true` only if their text content matches.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(DTD a,
                                      DTD b)

  Compares two `DTD`s. This method will return `true` only if their declarations are identical.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(EndDocument a,
                                      EndDocument b)

  Compares two `EndDocument`s. Because `EndDocument` events have no real state, two instances always match.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(EndElement a,
                                      EndElement b)

  Compares two `EndElement`s. This method will return `true` only if their names match.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(EntityDeclaration a,
                                      EntityDeclaration b)

  Compares two `EntityDeclaration`s. This method will return `true` only 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:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(EntityReference a,
                                      EntityReference b)

  Compares two `EntityReference`s. This method will return `true` only if the two references have the same name, and their declarations also match.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(Namespace a,
                                      Namespace b)

  Compares two `Namespace`s. This method will return `true` only if the two namespaces have identical prefixes and namespace URIs.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(NotationDeclaration a,
                                      NotationDeclaration b)

  Compares two `NotationDeclaration`s. This method will return `true` only if the two namespaces have identical names, public IDs, and system IDs.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(ProcessingInstruction a,
                                      ProcessingInstruction b)

  Compares two `ProcessingInstruction`s. This method will return `true` only if the two events have identical targets and data.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(StartDocument a,
                                      StartDocument b)

  Compares two `StartDocument`s. This method will return `true` only if the two events have identical encodings, versions, and have the same standalone setting.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### eventsMatch

    public static boolean eventsMatch(StartElement a,
                                      StartElement b)

  Compares two `StartElement`s. This method will return `true` only if the two events have identical names, attributes, and namespaces.

  Parameters:
    `a` - The first event.
    `b` - The second event.
  Returns:
    `true` if the events match, `false` otherwise.

### matchAttributes

    public static boolean matchAttributes(Iterator a,
                                          Iterator b)

  Iterates over two sets of `Attribute`s and determines if both contain matching attributes.

  Parameters:
    `a` - The first set of `Attribute`s.
    `b` - The second set of `Attribute`s.
  Returns:
    `true` if the two iterators iterate over matching attributes, `false` otherwise.

### matchNamespaces

    public static boolean matchNamespaces(Iterator a,
                                          Iterator b)

  Iterates over two sets of `Namespace`s and determines if both contain matching namespaces.

  Parameters:
    `a` - The first set of `Namespace`s.
    `b` - The second set of `Namespace`s.
  Returns:
    `true` if the two iterators iterate over matching namespaces, `false` otherwise.