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


Java XMLEventFactory.createCharacters方法代码示例

本文整理汇总了Java中javax.xml.stream.XMLEventFactory.createCharacters方法的典型用法代码示例。如果您正苦于以下问题:Java XMLEventFactory.createCharacters方法的具体用法?Java XMLEventFactory.createCharacters怎么用?Java XMLEventFactory.createCharacters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.stream.XMLEventFactory的用法示例。


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

示例1: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
private void createNode(XMLEventWriter eventWriter, String name,

  String value) throws XMLStreamException {
    XMLEventFactory eventFactory = XMLEventFactory.newInstance();
    XMLEvent end = eventFactory.createDTD("\n");
    XMLEvent tab = eventFactory.createDTD("\t");
    // create Start node
    StartElement sElement = eventFactory.createStartElement("", "", name);
    eventWriter.add(tab);
    eventWriter.add(sElement);
    // create Content
    Characters characters = eventFactory.createCharacters(value);
    eventWriter.add(characters);
    // create End node
    EndElement eElement = eventFactory.createEndElement("", "", name);
    eventWriter.add(eElement);
    eventWriter.add(end);
  }
 
开发者ID:htools,项目名称:htools,代码行数:19,代码来源:RSSFeedWriter.java

示例2: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
	XMLEventFactory eventFactory = XMLEventFactory.newInstance();
	XMLEvent end = eventFactory.createDTD("\n");
	XMLEvent tab = eventFactory.createDTD("\t");
	// Create Start node
	StartElement sElement = eventFactory.createStartElement("", "", name);
	eventWriter.add(tab);
	eventWriter.add(sElement);
	// Create Content
	Characters characters = eventFactory.createCharacters(value);
	eventWriter.add(characters);
	// Create End node
	EndElement eElement = eventFactory.createEndElement("", "", name);
	eventWriter.add(eElement);
	eventWriter.add(end);
}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:17,代码来源:EntityRepository.java

示例3: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
	XMLEventFactory eventFactory = XMLEventFactory.newInstance();
	XMLEvent end = eventFactory.createDTD("\n");
	XMLEvent tab = eventFactory.createDTD("\t");
	// Create start node
	StartElement sElement = eventFactory.createStartElement("", "", name);
	eventWriter.add(tab);
	eventWriter.add(sElement);
	// Create Content
	Characters characters = eventFactory.createCharacters(value);
	eventWriter.add(characters);
	// Create End node
	EndElement eElement = eventFactory.createEndElement("", "", name);
	eventWriter.add(eElement);
	eventWriter.add(end);
}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:17,代码来源:EmployeeRepository.java

示例4: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {

		XMLEventFactory eventFactory = XMLEventFactory.newInstance();
		XMLEvent end = eventFactory.createDTD("\n");
		XMLEvent tab = eventFactory.createDTD("\t");

		StartElement sElement = eventFactory.createStartElement("", "", name);
		eventWriter.add(tab);
		eventWriter.add(sElement);

		Characters characters = eventFactory.createCharacters(value);
		eventWriter.add(characters);

		EndElement eElement = eventFactory.createEndElement("", "", name);
		eventWriter.add(eElement);
		eventWriter.add(end);
	}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:18,代码来源:EntityRepository.java

示例5: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
/**
 * 
 * @param eventWriter
 *            .
 * @param name
 *            The name.
 * @param value
 *            The value.
 * @throws XMLStreamException
 *             .
 */
public static void createNode(final XMLEventWriter eventWriter, final String name, final String value)
		throws XMLStreamException {
	XMLEventFactory eventFactory = XMLEventFactory.newInstance();
	XMLEvent end = eventFactory.createDTD("\n");
	XMLEvent tab = eventFactory.createDTD("\t");
	// Create Start node
	StartElement sElement = eventFactory.createStartElement("", "", name);
	eventWriter.add(tab);
	eventWriter.add(sElement);
	// Create Content
	Characters characters = eventFactory.createCharacters(value);
	eventWriter.add(characters);
	// Create End node
	EndElement eElement = eventFactory.createEndElement("", "", name);
	eventWriter.add(eElement);
	eventWriter.add(end);
}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:29,代码来源:EntityRepository.java

示例6: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {

		XMLEventFactory eventFactory = XMLEventFactory.newInstance();
		XMLEvent end = eventFactory.createDTD("\n");
		XMLEvent tab = eventFactory.createDTD("\t");

		// Create start node
		StartElement sElement = eventFactory.createStartElement("", "", name);
		eventWriter.add(tab);
		eventWriter.add(sElement);

		// Create content

		Characters characters = eventFactory.createCharacters(value);
		eventWriter.add(characters);

		// Create end node

		EndElement eElement = eventFactory.createEndElement("", "", name);
		eventWriter.add(eElement);
		eventWriter.add(end);
	}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:23,代码来源:AnimalRepository.java

示例7: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {

			XMLEventFactory eventFactory = XMLEventFactory.newInstance();
			XMLEvent end = eventFactory.createDTD("\n");
			XMLEvent tab = eventFactory.createDTD("\t");

			// Create start node
			StartElement sElement = eventFactory.createStartElement("", "", name);
			eventWriter.add(tab);
			eventWriter.add(sElement);

			// Create content

			Characters characters = eventFactory.createCharacters(value);
			eventWriter.add(characters);

			// Create end node

			EndElement eElement = eventFactory.createEndElement("", "", name);
			eventWriter.add(eElement);
			eventWriter.add(end);
		}
 
开发者ID:JavaSummer,项目名称:JavaMainRepo,代码行数:23,代码来源:EmployeeRepository.java

示例8: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
private static void createNode(XMLEventWriter eventWriter, String name,
		String value) throws XMLStreamException {
	XMLEventFactory eventFactory = XMLEventFactory.newInstance();
	XMLEvent endSection = eventFactory.createDTD(XML_BLOCK);
	XMLEvent tabSection = eventFactory.createDTD(XML_INDENT);

	StartElement sElement = eventFactory.createStartElement("", "", name);
	eventWriter.add(tabSection);
	eventWriter.add(sElement);

	Characters characters = eventFactory.createCharacters(value);
	eventWriter.add(characters);

	EndElement eElement = eventFactory.createEndElement("", "", name);
	eventWriter.add(eElement);
	eventWriter.add(endSection);
}
 
开发者ID:machadolucas,项目名称:avanto,代码行数:18,代码来源:RssWriter.java

示例9: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
private void createNode(XMLEventWriter eventWriter, String name,
		String value) throws XMLStreamException {

	XMLEventFactory eventFactory = XMLEventFactory.newInstance();
	
	//XMLEvent end = eventFactory.createDTD("\n");
	//XMLEvent tab = eventFactory.createDTD("\t");
	
	// Create Start node
	StartElement sElement = eventFactory.createStartElement("", "", name);
	//eventWriter.add(tab);
	eventWriter.add(sElement);
	// Create Content
	Characters characters = eventFactory.createCharacters(value);
	eventWriter.add(characters);
	// Create End node
	EndElement eElement = eventFactory.createEndElement("", "", name);
	eventWriter.add(eElement);
	//eventWriter.add(end);

}
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:22,代码来源:StaxWriter.java

示例10: write

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
@Override
public void write(XMLEventWriter writer) throws IOException {
	try {
		XMLEventFactory eventFactory = XMLEventFactory.newInstance();

		XMLEvent event = eventFactory.createStartElement("", "", "footer");
		writer.add(event);

		event = eventFactory.createStartElement("", "", "writeCount");
		writer.add(event);

		event = eventFactory.createCharacters(String.valueOf(stepExecution.getWriteCount()));
		writer.add(event);

		event = eventFactory.createEndElement("", "", "writeCount");
		writer.add(event);

		event = eventFactory.createEndElement("", "", "footer");
		writer.add(event);
	} catch (XMLStreamException ignored) {
		log.warn("Footer 작업 중 예외가 발생했습니다.", ignored);
	}
}
 
开发者ID:debop,项目名称:spring-batch-experiments,代码行数:24,代码来源:ProductFooterStaxCallback.java

示例11: addDTD

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
protected void addDTD(StartElement event) throws XMLStreamException
{
 QName qName = ((StartElement)event).getName();
 String name = qName.getPrefix();
 if (null == name)
  name = "";
 else if (0 < name.length())
  name += ':';
 name += qName.getLocalPart();
 XMLEventFactory eventFactory = getXMLEventFactory();
 DTD dtdEvent = eventFactory.createDTD("<!DOCTYPE " + name + '>');
 super.add(dtdEvent);
 super.add(eventFactory.createCharacters("\n"));
}
 
开发者ID:StanLivitski,项目名称:HTMLtoc,代码行数:15,代码来源:Transformer.java

示例12: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
private void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
  XMLEventFactory eventFactory = XMLEventFactory.newInstance();
  XMLEvent end = eventFactory.createDTD("\n");
  XMLEvent tab = eventFactory.createDTD("\t");
  StartElement sElement = eventFactory.createStartElement(BLANK, BLANK, name);
  eventWriter.add(tab);
  eventWriter.add(sElement);
  Characters characters = eventFactory.createCharacters(value);
  eventWriter.add(characters);
  EndElement eElement = eventFactory.createEndElement(BLANK, BLANK, name);
  eventWriter.add(eElement);
  eventWriter.add(end);
}
 
开发者ID:pla1,项目名称:TextFeed2Images,代码行数:14,代码来源:FeedProcessorServlet.java

示例13: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
private void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
  XMLEventFactory eventFactory = XMLEventFactory.newInstance();
  XMLEvent end = eventFactory.createDTD("\n");
  XMLEvent tab = eventFactory.createDTD("\t");
  StartElement sElement = eventFactory.createStartElement(Constants.BLANK, Constants.BLANK, name);
  eventWriter.add(tab);
  eventWriter.add(sElement);
  Characters characters = eventFactory.createCharacters(value);
  eventWriter.add(characters);
  EndElement eElement = eventFactory.createEndElement(Constants.BLANK, Constants.BLANK, name);
  eventWriter.add(eElement);
  eventWriter.add(end);
}
 
开发者ID:pla1,项目名称:TextFeed2Images,代码行数:14,代码来源:NFLTeamImage.java

示例14: createNode

import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
private void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
	XMLEventFactory eventFactory = XMLEventFactory.newInstance();
	XMLEvent end = eventFactory.createDTD("\n");
	XMLEvent tab = eventFactory.createDTD("\t");
	StartElement sElement = eventFactory.createStartElement(Constants.BLANK, Constants.BLANK, name);
	eventWriter.add(tab);
	eventWriter.add(sElement);
	Characters characters = eventFactory.createCharacters(value);
	eventWriter.add(characters);
	EndElement eElement = eventFactory.createEndElement(Constants.BLANK, Constants.BLANK, name);
	eventWriter.add(eElement);
	eventWriter.add(end);
}
 
开发者ID:pla1,项目名称:TextFeed2Images,代码行数:14,代码来源:StartupServlet.java

示例15: testEvents

import javax.xml.stream.XMLEventFactory; //导入方法依赖的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


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