当前位置: 首页>>代码示例>>Java>>正文


Java EntityDeclaration类代码示例

本文整理汇总了Java中javax.xml.stream.events.EntityDeclaration的典型用法代码示例。如果您正苦于以下问题:Java EntityDeclaration类的具体用法?Java EntityDeclaration怎么用?Java EntityDeclaration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EntityDeclaration类属于javax.xml.stream.events包,在下文中一共展示了EntityDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: equals

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
@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())
        ;
}
 
开发者ID:FasterXML,项目名称:woodstox,代码行数:18,代码来源:WEntityDeclaration.java

示例2: DisplayEntities

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
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());
        }
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:SupportDTDTest.java

示例3: testDTDEvent

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
/**
 * 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());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:Issue48Test.java

示例4: EntityReferenceImpl

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
protected EntityReferenceImpl(Location location,
                              EntityDeclaration decl,
                              String name)
{
  super(location);
  this.decl = decl;
  this.name = name;
}
 
开发者ID:vilie,项目名称:javify,代码行数:9,代码来源:EntityReferenceImpl.java

示例5: getEntities

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
@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;
}
 
开发者ID:FasterXML,项目名称:woodstox,代码行数:13,代码来源:WDTD.java

示例6: testSimpleEntity

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
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();
}
 
开发者ID:FasterXML,项目名称:woodstox,代码行数:15,代码来源:TestDoctypeDecl.java

示例7: isEntityUnparsed

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
public boolean isEntityUnparsed(String name) {
    if (fEntities != null) {
        EntityDeclaration entityDecl = (EntityDeclaration) fEntities.get(name);
        // If the entity is associated with a notation then it must be an unparsed entity.
        if (entityDecl != null) {
            return (entityDecl.getNotationName() != null);
        }
    }
    return false;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:11,代码来源:StAXValidatorHelper.java

示例8: processEntityDeclarations

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
/** Copies entity declarations into a hash map. */
final void processEntityDeclarations(List entityDecls) {
    int size = (entityDecls != null) ? entityDecls.size() : 0;
    if (size > 0) {
        if (fEntities == null) {
            fEntities = new HashMap();
        }
        for (int i = 0; i < size; ++i) {
            EntityDeclaration decl = (EntityDeclaration) entityDecls.get(i);
            fEntities.put(decl.getName(), decl);
        }
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:14,代码来源:StAXValidatorHelper.java

示例9: getElementText

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
@Override
public final String getElementText() throws XMLStreamException {
	XMLEvent event = this.previousEvent;
	if (event == null) {
		throw new XMLStreamException("Must be on START_ELEMENT to read next text, element was null");
	}
	if (!event.isStartElement()) {
		throw new XMLStreamException("Must be on START_ELEMENT to read next text", event.getLocation());
	}

	final StringBuilder text = new StringBuilder();
	while (!event.isEndDocument()) {
		switch (event.getEventType()) {
			case XMLStreamConstants.CHARACTERS:
			case XMLStreamConstants.SPACE:
			case XMLStreamConstants.CDATA: {
				final Characters characters = event.asCharacters();
				text.append(characters.getData());
				break;
			}
			case XMLStreamConstants.ENTITY_REFERENCE: {
				final EntityReference entityReference = (EntityReference)event;
				final EntityDeclaration declaration = entityReference.getDeclaration();
				text.append(declaration.getReplacementText());
				break;
			}
			case XMLStreamConstants.COMMENT:
			case XMLStreamConstants.PROCESSING_INSTRUCTION: {
				//Ignore
				break;
			}
			default: {
				throw new XMLStreamException("Unexpected event type '" + XMLStreamConstantsUtils.getEventName(event.getEventType()) + "' encountered. Found event: " + event, event.getLocation());
			}
		}

		event = this.nextEvent();
	}

	return text.toString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:42,代码来源:BaseXMLEventReader.java

示例10: EntityReferenceEvent

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) {
    init();
    _entityName = entityName;
    _entityDeclaration = entityDeclaration;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:EntityReferenceEvent.java

示例11: getDeclaration

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
/**
* Return the declaration of this entity.
*/
 public EntityDeclaration getDeclaration(){
     return _entityDeclaration ;
 }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:EntityReferenceEvent.java

示例12: setDeclaration

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
public void setDeclaration(EntityDeclaration declaration) {
    _entityDeclaration = declaration ;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:EntityReferenceEvent.java

示例13: EntityReferenceEvent

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) {
    init();
    fEntityName = entityName;
    fEntityDeclaration = entityDeclaration ;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:EntityReferenceEvent.java

示例14: getDeclaration

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
public EntityDeclaration getDeclaration(){
    return fEntityDeclaration ;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:EntityReferenceEvent.java

示例15: createEntityReference

import javax.xml.stream.events.EntityDeclaration; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:XMLEventFactoryImpl.java


注:本文中的javax.xml.stream.events.EntityDeclaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。