javax.xml.stream.events.EntityDeclaration Java Examples

The following examples show how to use javax.xml.stream.events.EntityDeclaration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WEntityDeclaration.java    From woodstox with Apache License 2.0 6 votes vote down vote up
@Override
public boolean equals(Object o)
{
    if (o == this) return true;
    if (o == null) return false;

    if (!(o instanceof EntityDeclaration)) return false;

    EntityDeclaration other = (EntityDeclaration) o;
    return stringsWithNullsEqual(getName(), other.getName())
        && stringsWithNullsEqual(getBaseURI(), other.getBaseURI())
        && stringsWithNullsEqual(getNotationName(), other.getNotationName())
        && stringsWithNullsEqual(getPublicId(), other.getPublicId())
        && stringsWithNullsEqual(getReplacementText(), other.getReplacementText())
        && stringsWithNullsEqual(getSystemId(), other.getSystemId())
        ;
}
 
Example #2
Source File: TestDoctypeDecl.java    From woodstox with Apache License 2.0 5 votes vote down vote up
public void testSimpleEntity()
    throws XMLStreamException
{
    XMLStreamReader sr = getReader(UNPARSED_ENTITY_XML, true);
    assertTokenType(DTD, sr.next());
    List<?> l = (List<?>) sr.getProperty("javax.xml.stream.entities");
    assertNotNull(l);
    assertEquals(1, l.size());
    EntityDeclaration ed = (EntityDeclaration) l.get(0);
    assertEquals("unp", ed.getName());
    assertEquals("mynot", ed.getNotationName());

    sr.close();
}
 
Example #3
Source File: WDTD.java    From woodstox with Apache License 2.0 5 votes vote down vote up
@Override
public List<EntityDeclaration> getEntities()
{
    if (mEntities == null && (mSubset != null)) {
        /* Better make a copy, so that caller can not modify list
         * DTD has, which may be shared (since DTD subset instances
         * are cached and reused)
         */
        mEntities = new ArrayList<EntityDeclaration>(mSubset.getGeneralEntityList());
    }
    return mEntities;
}
 
Example #4
Source File: Issue48Test.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * DTDEvent instances constructed via event reader are missing the notation
 * and entity declaration information
 */
@Test
public void testDTDEvent() {
    String XML = "<?xml version='1.0' ?>" + "<!DOCTYPE root [\n" + "<!ENTITY intEnt 'internal'>\n" + "<!ENTITY extParsedEnt SYSTEM 'url:dummy'>\n"
            + "<!NOTATION notation PUBLIC 'notation-public-id'>\n" + "<!NOTATION notation2 SYSTEM 'url:dummy'>\n"
            + "<!ENTITY extUnparsedEnt SYSTEM 'url:dummy2' NDATA notation>\n" + "]>" + "<root />";

    try {
        XMLEventReader er = getReader(XML);
        XMLEvent evt = er.nextEvent(); // StartDocument
        evt = er.nextEvent(); // DTD
        if (evt.getEventType() != XMLStreamConstants.DTD) {
            Assert.fail("Expected DTD event");
        }
        DTD dtd = (DTD) evt;
        List entities = dtd.getEntities();
        if (entities == null) {
            Assert.fail("No entity found. Expected 3.");
        } else {
            Assert.assertEquals(entities.size(), 3);
        }
        // Let's also verify they are all of right type...
        testListElems(entities, EntityDeclaration.class);

        List notations = dtd.getNotations();
        if (notations == null) {
            Assert.fail("No notation found. Expected 2.");
        } else {
            Assert.assertEquals(notations.size(), 2);
        }
        // Let's also verify they are all of right type...
        testListElems(notations, NotationDeclaration.class);
    } catch (Exception e) {
        Assert.fail(e.getMessage());
    }
}
 
Example #5
Source File: SupportDTDTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void DisplayEntities(DTD event) {
    List entities = event.getEntities();
    if (entities == null) {
        _hasEntityDelaration = false;
        print("No entity found.");
    } else {
        _hasEntityDelaration = true;
        for (int i = 0; i < entities.size(); i++) {
            EntityDeclaration entity = (EntityDeclaration) entities.get(i);
            print(entity.getName());
        }
    }

}
 
Example #6
Source File: EntityReferenceEvent.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) {
    init();
    fEntityName = entityName;
    fEntityDeclaration = entityDeclaration ;
}
 
Example #7
Source File: EntityReferenceEvent.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
* Return the declaration of this entity.
*/
 public EntityDeclaration getDeclaration(){
     return _entityDeclaration ;
 }
 
Example #8
Source File: EntityReferenceEvent.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public EntityDeclaration getDeclaration(){
    return fEntityDeclaration ;
}
 
Example #9
Source File: StaxEventXMLReader.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
private void handleEntityDeclaration(EntityDeclaration entityDeclaration) throws SAXException {
	if (getDTDHandler() != null) {
		getDTDHandler().unparsedEntityDecl(entityDeclaration.getName(), entityDeclaration.getPublicId(),
				entityDeclaration.getSystemId(), entityDeclaration.getNotationName());
	}
}
 
Example #10
Source File: WEntityReference.java    From woodstox with Apache License 2.0 4 votes vote down vote up
/**
 * This constructor gets called for undeclared/defined entities: we will
 * still know the name (from the reference), but not how it's defined
 * (since it is not defined).
 */
public WEntityReference(Location loc, String name)
{
    super(loc, (EntityDeclaration) null);
    mName = name;
}
 
Example #11
Source File: WEntityReference.java    From woodstox with Apache License 2.0 4 votes vote down vote up
public WEntityReference(Location loc, EntityDeclaration decl)
{
    super(loc, decl);
    mName = null;
}
 
Example #12
Source File: XMLEventFactoryImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public javax.xml.stream.events.EntityReference createEntityReference(String name, EntityDeclaration entityDeclaration) {
    EntityReferenceEvent event =  new EntityReferenceEvent(name, entityDeclaration);
    if(location != null)event.setLocation(location);
    return event;
}
 
Example #13
Source File: EntityReferenceEvent.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public EntityDeclaration getDeclaration(){
    return fEntityDeclaration ;
}
 
Example #14
Source File: EntityReferenceEvent.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) {
    init();
    fEntityName = entityName;
    fEntityDeclaration = entityDeclaration ;
}
 
Example #15
Source File: EntityReferenceEvent.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void setDeclaration(EntityDeclaration declaration) {
    _entityDeclaration = declaration ;
}
 
Example #16
Source File: EntityReferenceEvent.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
* Return the declaration of this entity.
*/
 public EntityDeclaration getDeclaration(){
     return _entityDeclaration ;
 }
 
Example #17
Source File: EntityReferenceEvent.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) {
    init();
    _entityName = entityName;
    _entityDeclaration = entityDeclaration;
}
 
Example #18
Source File: EntityReferenceEvent.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
* Return the declaration of this entity.
*/
 public EntityDeclaration getDeclaration(){
     return _entityDeclaration ;
 }
 
Example #19
Source File: EntityReferenceEvent.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void setDeclaration(EntityDeclaration declaration) {
    _entityDeclaration = declaration ;
}
 
Example #20
Source File: EntityReferenceEvent.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
* Return the declaration of this entity.
*/
 public EntityDeclaration getDeclaration(){
     return _entityDeclaration ;
 }
 
Example #21
Source File: EntityReferenceEvent.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) {
    init();
    _entityName = entityName;
    _entityDeclaration = entityDeclaration;
}
 
Example #22
Source File: XMLEventFactoryImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public EntityReference createEntityReference(String name, EntityDeclaration declaration) {
    return null;
}
 
Example #23
Source File: XMLEventFactoryWrapper.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public EntityReference createEntityReference(String name, EntityDeclaration declaration) {
    return defaultImpl.createEntityReference(name, declaration);
}
 
Example #24
Source File: XMLEventFactoryImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public EntityReference createEntityReference(String name, EntityDeclaration entityDeclaration) {
    EntityReferenceEvent event =  new EntityReferenceEvent(name, entityDeclaration);
    if(location != null)event.setLocation(location);
    return event;
}
 
Example #25
Source File: DTDEvent.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public List<EntityDeclaration> getEntities() {
    return fEntities;
}
 
Example #26
Source File: DTDEvent.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void setEntities(List<EntityDeclaration> entites) {
    fEntities = entites;
}
 
Example #27
Source File: EntityReferenceEvent.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public EntityDeclaration getDeclaration(){
    return fEntityDeclaration ;
}
 
Example #28
Source File: EntityReferenceEvent.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) {
    init();
    fEntityName = entityName;
    fEntityDeclaration = entityDeclaration ;
}
 
Example #29
Source File: EntityReferenceEvent.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void setDeclaration(EntityDeclaration declaration) {
    _entityDeclaration = declaration ;
}
 
Example #30
Source File: EntityReferenceEvent.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) {
    init();
    _entityName = entityName;
    _entityDeclaration = entityDeclaration;
}