/** * Compares two {@link Characters}s. This method will return <code>true</code> * only if they have the same event type ({@link XMLEvent#CHARACTERS}, * {@link XMLEvent#CDATA}, or {@link XMLEvent#SPACE}), and their text content * matches. * * @param a The first event. * @param b The second event. * @return <code>true</code> if the events match, <code>false</code> otherwise. */ public static boolean eventsMatch(Characters a, Characters b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } else if (a.getEventType() == b.getEventType()) { return a.getData().equals(b.getData()); } else { return false; } }
Characters characters = (Characters) event; switch (characters.getEventType()) { case CDATA: _out.writeCData(characters.getData());