1 38 39 package com.sun.xml.fastinfoset.stax.events ; 40 41 import javax.xml.stream.events.EntityReference; 42 import javax.xml.stream.events.EntityDeclaration; 43 import javax.xml.stream.XMLStreamConstants; 44 45 46 public class EntityReferenceEvent extends EventBase implements EntityReference { 47 private EntityDeclaration _entityDeclaration ; 48 private String _entityName; 49 50 public EntityReferenceEvent() { 51 init(); 52 } 53 54 public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) { 55 init(); 56 _entityName = entityName; 57 _entityDeclaration = entityDeclaration; 58 } 59 60 64 public String getName() { 65 return _entityName; 66 } 67 68 71 public EntityDeclaration getDeclaration(){ 72 return _entityDeclaration ; 73 } 74 75 public void setName(String name){ 76 _entityName = name; 77 } 78 79 public void setDeclaration(EntityDeclaration declaration) { 80 _entityDeclaration = declaration ; 81 } 82 83 public String toString() { 84 String text = _entityDeclaration.getReplacementText(); 85 if(text == null) 86 text = ""; 87 return "&" + getName() + ";='" + text + "'"; 88 } 89 90 protected void init() { 91 setEventType(ENTITY_REFERENCE); 92 } 93 94 95 } 96 | Popular Tags |