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


Java EndDocument类代码示例

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


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

示例1: init

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
protected void init(InputStream is) throws XMLStreamException {
    XMLInputFactory factory = XMLInputFactory.newInstance();
    reader = factory.createXMLEventReader(is);
    while(true) {
        XMLEvent event = reader.nextEvent();
        if(event instanceof EndDocument) {
            reader.close();
            break;
        }
        if(event instanceof StartElement) {
            onStartElement((StartElement)event);
        }
        if(event instanceof EndElement) {
            onEndElement((EndElement)event);
        }
    }
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:18,代码来源:AbstractList.java

示例2: doGetValue

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
@Override
protected Map<Integer, List<String>> doGetValue(String entityType) {
    Map<Integer, List<String>> map = new HashMap<Integer, List<String>>();
    try {
        InputStream is = restService.getForStream("customization/entities/{0}/lists", entityType);
        XMLInputFactory factory = XMLInputFactory.newInstance();
        XMLEventReader reader = factory.createXMLEventReader(is);
        int listId = 0;
        while(true) {
            XMLEvent event = reader.nextEvent();
            if(event instanceof EndDocument) {
                reader.close();
                break;
            }
            if(event instanceof StartElement) {
                String localPart = ((StartElement) event).getName().getLocalPart();
                if("Id".equals(localPart)) {
                    listId = Integer.valueOf(AbstractList.readNextValue(reader));
                    map.put(listId, new ArrayList<String>());
                } else if("Item".equals(localPart)) {
                    String value = ((StartElement) event).getAttributeByName(new QName(null, "value")).getValue();
                    map.get(listId).add(value);
                }
            }
        }
    } catch(XMLStreamException e) {
        // return what was read so far
    }
    return map;
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:31,代码来源:ProjectListService.java

示例3: testEvents

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
@Test
public void testEvents() {
    XMLEventFactory f = XMLEventFactory.newInstance();
    final String contents = "test <some> text & more! [[]] --";
    final String prefix = "prefix";
    final String uri = "http://foo";
    final String localName = "elem";

    try {
        StartDocument sd = f.createStartDocument();
        writeAsEncodedUnicode(sd);

        Comment c = f.createComment("some comments");
        writeAsEncodedUnicode(c);

        StartElement se = f.createStartElement(prefix, uri, localName);

        ProcessingInstruction pi = f.createProcessingInstruction("target", "data");
        writeAsEncodedUnicode(pi);

        Namespace ns = f.createNamespace(prefix, uri);
        writeAsEncodedUnicode(ns);

        Characters characters = f.createCharacters(contents);
        writeAsEncodedUnicode(characters);
        // CData
        Characters cdata = f.createCData(contents);
        writeAsEncodedUnicode(cdata);

        // Attribute
        QName attrName = new QName("http://test.com", "attr", "ns");
        Attribute attr = f.createAttribute(attrName, "value");
        writeAsEncodedUnicode(attr);

        // prefix, uri, localName
        EndElement ee = f.createEndElement(prefix, uri, localName);
        writeAsEncodedUnicode(ee);

        EndDocument ed = f.createEndDocument();
        writeAsEncodedUnicode(ed);
    } catch (Exception e) {
        Assert.fail(e.getMessage());
    }

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

示例4: createEndDocument

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
@Override
public EndDocument createEndDocument() {
    return defaultImpl.createEndDocument();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:XMLEventFactoryWrapper.java

示例5: createEndDocument

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
@Override
public EndDocument createEndDocument() {
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:XMLEventFactoryImpl.java

示例6: createEndDocument

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
public EndDocument createEndDocument()
{
  return new EndDocumentImpl(location);
}
 
开发者ID:vilie,项目名称:javify,代码行数:5,代码来源:XMLEventFactoryImpl.java

示例7: createEndDocument

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
@Override
public EndDocument createEndDocument()
{
    return delegate.createEndDocument();
}
 
开发者ID:werval,项目名称:werval,代码行数:6,代码来源:XMLEventFactoryImpl.java

示例8: createEndDocument

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
public EndDocument createEndDocument() {
    return new EndDocumentImpl(fLocation);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:4,代码来源:XMLEventFactoryImpl.java

示例9: endDocument

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
public void endDocument(EndDocument event) throws XMLStreamException {
    fEventWriter.add(event);
    fEventWriter.flush();
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:5,代码来源:StAXEventResultBuilder.java

示例10: endDocument

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
public void endDocument(EndDocument event) throws XMLStreamException {
    fStreamWriter.writeEndDocument();
    fStreamWriter.flush();
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:5,代码来源:StAXStreamResultBuilder.java

示例11: index

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
protected void index(XMLEvent event) throws XMLStreamException
 {
  final Location location = event.getLocation();
  try
  {
   if (event instanceof EndDocument)
   {
    if (null != context)
     trackContext(event);
    if (null != formatter)
    {
     formatter.end();
     conveyFormatted();
    }
    for (XMLEvent resumed : deferred)
     super.add(resumed);
    super.add(event);
   }
   else if (event instanceof EndElement && null != context && context.isEmpty())
   {
    EndElement close = (EndElement)event;
    if (!((StartElement)origin).getName().equals(close.getName()))
     throw new IllegalStateException("Unclosed " + describeEvent(origin) + ' '
         + describeLocation(origin.getLocation()));
    endContext();
    if (null != formatter)
    {
     formatter.closeItem(event);
     conveyFormatted();
    }
    deferred.add(event);
   }
   else if (null == context)
   {
    String id = null;
    if (null != formatter && formatter.accept(event))
    {
     event = assignIdToElement((StartElement)event);
     id = ((StartElement)event).getAttributeByName(ID_ATTR_QNAME).getValue();
    }
    deferred.add(event);
    if (null != id)
    {
     XMLEventFactory eventFactory = getXMLEventFactory();
     Set<Attribute> attrs = Collections.singleton(
eventFactory.createAttribute("name", id)
     );
     deferred.add(eventFactory.createStartElement(
DEFAULT_NS_PREFIX,
NULL_NS_URI,
"a",
attrs.iterator(),
Collections.EMPTY_SET.iterator()));
     deferred.add(eventFactory.createCharacters(" "));
     deferred.add(eventFactory.createEndElement(DEFAULT_NS_PREFIX, NULL_NS_URI, "a"));
     if (null != formatter)
     {
      formatter.openItem(event, id);
      conveyFormatted();
     }
     enterContext(event);
    }
   }
   else // null != context
   {
    trackContext(event);
    deferred.add(event);
    if (null != formatter)
    {
     formatter.addContent(event);
     conveyFormatted();
    }
   }
  }
  catch (RuntimeException error)
  {
   throw new XMLStreamException(error.getLocalizedMessage(), location, error);
  }
 }
 
开发者ID:StanLivitski,项目名称:HTMLtoc,代码行数:80,代码来源:Transformer.java

示例12: createEndDocument

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
/**
 * Create an end-document event.
 */
public abstract EndDocument createEndDocument();
 
开发者ID:vilie,项目名称:javify,代码行数:5,代码来源:XMLEventFactory.java

示例13: endDocument

import javax.xml.stream.events.EndDocument; //导入依赖的package包/类
public void endDocument(EndDocument event) throws XMLStreamException; 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:2,代码来源:StAXDocumentHandler.java


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