final EntityDeclaration declaration = entityReference.getDeclaration(); text.append(declaration.getReplacementText()); break;
final EntityDeclaration declaration = entityReference.getDeclaration(); text.append(declaration.getReplacementText()); break;
/** * Constructs a new DOM4J Entity from the provided StAX EntityReference * event. * * @param entityRef * The EntityReference event from which to construct the new * DOM4J Entity. * * @return The Entity constructed from the provided EntityReference event. */ public org.dom4j.Entity createEntity(EntityReference entityRef) { return factory.createEntity(entityRef.getName(), entityRef .getDeclaration().getReplacementText()); }
public EntityReferenceEvent(EntityReference that) { super(that); this.name = that.getName(); this.declaration = that.getDeclaration(); }
/** * Compares two {@link EntityReference}s. This method will return * <code>true</code> only if the two references have the same name, and their * declarations also match. * * @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(EntityReference a, EntityReference b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } if (a.getName().equals(b.getName())) { return eventsMatch(a.getDeclaration(), b.getDeclaration()); } else { return false; } }
public boolean equals(Object o) { if (! (o instanceof EntityReference)) return false; if (o == null) return false; if (this == o) return true; EntityReference entity = (EntityReference) o; return getName().equals(entity.getName()) && getDeclaration().equals(entity.getDeclaration()); } }
public String getText() { requiredEventType(CHARACTERS, DTD, ENTITY_REFERENCE, COMMENT, SPACE); if (current.isCharacters()) { return current.asCharacters().getData(); } else if (current.isEntityReference()) { return ((EntityReference)current).getDeclaration().getReplacementText(); } else if (current instanceof DTD) { // no idea what to do here return ""; } else if (current instanceof Comment) { return ((Comment) current).getText(); } else { // should never get here throw new IllegalStateException("Unexpected element type " + current); } }
/** * Constructs a new DOM4J Entity from the provided StAX EntityReference * event. * * @param entityRef * The EntityReference event from which to construct the new * DOM4J Entity. * * @return The Entity constructed from the provided EntityReference event. */ public org.dom4j.Entity createEntity(EntityReference entityRef) { return factory.createEntity(entityRef.getName(), entityRef .getDeclaration().getReplacementText()); }
/** * Constructs a new DOM4J Entity from the provided StAX EntityReference * event. * * @param entityRef * The EntityReference event from which to construct the new * DOM4J Entity. * * @return The Entity constructed from the provided EntityReference event. */ public org.dom4j.Entity createEntity(EntityReference entityRef) { return factory.createEntity(entityRef.getName(), entityRef .getDeclaration().getReplacementText()); }
public String getText() { requiredEventType(CHARACTERS, DTD, ENTITY_REFERENCE, COMMENT, SPACE); if (current.isCharacters()) { return current.asCharacters().getData(); } else if (current.isEntityReference()) { return ((EntityReference)current).getDeclaration().getReplacementText(); } else if (current instanceof DTD) { // no idea what to do here return ""; } else if (current instanceof Comment) { return ((Comment) current).getText(); } else { // should never get here throw new IllegalStateException("Unexpected element type " + current); } }
/** * Constructs a new DOM4J Entity from the provided StAX EntityReference * event. * * @param entityRef * The EntityReference event from which to construct the new * DOM4J Entity. * * @return The Entity constructed from the provided EntityReference event. */ public org.dom4j.Entity createEntity(EntityReference entityRef) { return factory.createEntity(entityRef.getName(), entityRef .getDeclaration().getReplacementText()); }
/** * Constructs a new DOM4J Entity from the provided StAX EntityReference * event. * * @param entityRef * The EntityReference event from which to construct the new * DOM4J Entity. * * @return The Entity constructed from the provided EntityReference event. */ public org.dom4j.Entity createEntity(EntityReference entityRef) { return factory.createEntity(entityRef.getName(), entityRef .getDeclaration().getReplacementText()); }
/** * Constructs a new DOM4J Entity from the provided StAX EntityReference * event. * * @param entityRef * The EntityReference event from which to construct the new * DOM4J Entity. * * @return The Entity constructed from the provided EntityReference event. */ public org.dom4j.Entity createEntity(EntityReference entityRef) { return factory.createEntity(entityRef.getName(), entityRef .getDeclaration().getReplacementText()); }
/** * Constructs a new DOM4J Entity from the provided StAX EntityReference * event. * * @param entityRef * The EntityReference event from which to construct the new * DOM4J Entity. * * @return The Entity constructed from the provided EntityReference event. */ public org.dom4j.Entity createEntity(EntityReference entityRef) { return factory.createEntity(entityRef.getName(), entityRef .getDeclaration().getReplacementText()); }
/** * Constructs a new DOM4J Entity from the provided StAX EntityReference * event. * * @param entityRef * The EntityReference event from which to construct the new * DOM4J Entity. * * @return The Entity constructed from the provided EntityReference event. */ public org.dom4j.Entity createEntity(EntityReference entityRef) { return factory.createEntity(entityRef.getName(), entityRef .getDeclaration().getReplacementText()); }
/** * Constructs a new DOM4J Entity from the provided StAX EntityReference * event. * * @param entityRef * The EntityReference event from which to construct the new * DOM4J Entity. * * @return The Entity constructed from the provided EntityReference event. */ public org.dom4j.Entity createEntity(EntityReference entityRef) { return factory.createEntity(entityRef.getName(), entityRef .getDeclaration().getReplacementText()); }
@Override public int getTextLength() { XMLSecEvent xmlSecEvent = getCurrentEvent(); switch (xmlSecEvent.getEventType()) { case ENTITY_REFERENCE: return ((EntityReference) xmlSecEvent).getDeclaration().getReplacementText().length(); case DTD: return ((DTD) xmlSecEvent).getDocumentTypeDeclaration().length(); case COMMENT: return ((Comment) xmlSecEvent).getText().length(); case CDATA: case SPACE: case CHARACTERS: return xmlSecEvent.asCharacters().getData().length(); default: throw new IllegalStateException("Current state not TEXT"); } }
@Override public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException { XMLSecEvent xmlSecEvent = getCurrentEvent(); switch (xmlSecEvent.getEventType()) { case ENTITY_REFERENCE: ((EntityReference) xmlSecEvent).getDeclaration().getReplacementText().getChars(sourceStart, sourceStart + length, target, targetStart); return length; case DTD: ((DTD) xmlSecEvent).getDocumentTypeDeclaration().getChars(sourceStart, sourceStart + length, target, targetStart); return length; case COMMENT: ((Comment) xmlSecEvent).getText().getChars(sourceStart, sourceStart + length, target, targetStart); return length; case CDATA: case SPACE: case CHARACTERS: xmlSecEvent.asCharacters().getData().getChars(sourceStart, sourceStart + length, target, targetStart); return length; default: throw new IllegalStateException("Current state not TEXT"); } }
@Override public char[] getTextCharacters() { XMLSecEvent xmlSecEvent = getCurrentEvent(); switch (xmlSecEvent.getEventType()) { case ENTITY_REFERENCE: return ((EntityReference) xmlSecEvent).getDeclaration().getReplacementText().toCharArray(); case DTD: return ((DTD) xmlSecEvent).getDocumentTypeDeclaration().toCharArray(); case COMMENT: return ((Comment) xmlSecEvent).getText().toCharArray(); case CDATA: case SPACE: case CHARACTERS: return xmlSecEvent.asCharacters().getText(); default: throw new IllegalStateException("Current state not TEXT"); } }
@Override public String getText() { XMLSecEvent xmlSecEvent = getCurrentEvent(); switch (xmlSecEvent.getEventType()) { case ENTITY_REFERENCE: return ((EntityReference) xmlSecEvent).getDeclaration().getReplacementText(); case DTD: return ((DTD) xmlSecEvent).getDocumentTypeDeclaration(); case COMMENT: return ((Comment) xmlSecEvent).getText(); case CDATA: case SPACE: case CHARACTERS: return xmlSecEvent.asCharacters().getData(); default: throw new IllegalStateException("Current state not TEXT"); } }