本文整理汇总了Java中javax.xml.stream.XMLEventFactory.createStartElement方法的典型用法代码示例。如果您正苦于以下问题:Java XMLEventFactory.createStartElement方法的具体用法?Java XMLEventFactory.createStartElement怎么用?Java XMLEventFactory.createStartElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.stream.XMLEventFactory
的用法示例。
在下文中一共展示了XMLEventFactory.createStartElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例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);
}
示例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);
}
示例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");
// 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);
}
示例5: save
import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public void save(ArrayList<T> entities) throws FileNotFoundException, XMLStreamException {
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(new FileOutputStream(this.xmlFilename));
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
StartDocument startDocument = eventFactory.createStartDocument();
eventWriter.add(startDocument);
StartElement configStartElement = eventFactory.createStartElement("", "", "content");
eventWriter.add(configStartElement);
eventWriter.add(end);
for (XML_Parsable entity : entities) {
StartElement sElement = eventFactory.createStartElement("", "", this.entityTag);
eventWriter.add(sElement);
eventWriter.add(end);
entity.encodeToXml(eventWriter);
EndElement eElement = eventFactory.createEndElement("", "", this.entityTag);
eventWriter.add(eElement);
eventWriter.add(end);
}
eventWriter.add(eventFactory.createEndElement("", "", "content"));
eventWriter.add(eventFactory.createEndDocument());
eventWriter.close();
}
示例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);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
}
示例10: save
import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public void save(ArrayList<Employee> employees) throws FileNotFoundException, XMLStreamException {
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
// Create XMLEventWriter
XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(new FileOutputStream(XML_FILENAME));
// Create a EventFactory
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
// Create and write Start Tag
StartDocument startDocument = eventFactory.createStartDocument();
eventWriter.add(startDocument);
// Create content open tag
StartElement configStartElement = eventFactory.createStartElement("", "", "content");
eventWriter.add(configStartElement);
eventWriter.add(end);
for (Employee employee : employees) {
StartElement sElement = eventFactory.createStartElement("", "", Constants.XML_TAGS.EMPLOYEE);
eventWriter.add(sElement);
eventWriter.add(end);
employee.encodeToXml(eventWriter);
EndElement eElement = eventFactory.createEndElement("", "", Constants.XML_TAGS.EMPLOYEE);
eventWriter.add(eElement);
eventWriter.add(end);
}
eventWriter.add(eventFactory.createEndElement("", "", "content"));
eventWriter.add(eventFactory.createEndDocument());
eventWriter.close();
}
示例11: save
import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public void save(ArrayList<T> entities) throws FileNotFoundException, XMLStreamException {
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
// Create XMLEventWriter
XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(new FileOutputStream(this.xmlFilename));
// Create a EventFactory
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
// Create and write Start Tag
StartDocument startDocument = eventFactory.createStartDocument();
eventWriter.add(startDocument);
// Create content open tag
StartElement configStartElement = eventFactory.createStartElement("", "", "content");
eventWriter.add(configStartElement);
eventWriter.add(end);
for (XML_Parsable entity : entities) {
StartElement sElement = eventFactory.createStartElement("", "", this.entityTag);
eventWriter.add(sElement);
eventWriter.add(end);
entity.encodeToXml(eventWriter);
EndElement eElement = eventFactory.createEndElement("", "", this.entityTag);
eventWriter.add(eElement);
eventWriter.add(end);
}
eventWriter.add(eventFactory.createEndElement("", "", "content"));
eventWriter.add(eventFactory.createEndDocument());
eventWriter.close();
}
示例12: 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);
}
示例13: save
import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public void save(ArrayList<T> entities) throws FileNotFoundException, XMLStreamException {
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(new FileOutputStream(this.xmlFilename));
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
StartDocument startDocument = eventFactory.createStartDocument();
eventWriter.add(startDocument);
StartElement configStartElement = eventFactory.createStartElement("", "", "content");
eventWriter.add(configStartElement);
eventWriter.add(end);
for (XML_Parsable entitity : entities) {
StartElement sElement = eventFactory.createStartElement("", "", this.entityTag);
eventWriter.add(sElement);
eventWriter.add(end);
entitity.encodeToXml(eventWriter);
EndElement eElement = eventFactory.createEndElement("", "", this.entityTag);
eventWriter.add(eElement);
eventWriter.add(end);
}
eventWriter.add(eventFactory.createEndElement("", "", "content"));
eventWriter.add(eventFactory.createEndDocument());
eventWriter.close();
}
示例14: save
import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public void save(ArrayList<Animal> animals) throws FileNotFoundException, XMLStreamException {
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
// Create XMLEventWriter
XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(new FileOutputStream(XML_FILENAME));
// Create a EventFactory
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
// Create and write Start Tag
StartDocument startDocument = eventFactory.createStartDocument();
eventWriter.add(startDocument);
// Create content open tag
StartElement configStartElement = eventFactory.createStartElement("", "", "content");
eventWriter.add(configStartElement);
eventWriter.add(end);
for (XML_Parsable animal : animals) {
StartElement sElement = eventFactory.createStartElement("", "", Constants.XML_TAGS.ANIMAL);
eventWriter.add(sElement);
eventWriter.add(end);
animal.encodeToXml(eventWriter);
EndElement eElement = eventFactory.createEndElement("", "", Constants.XML_TAGS.ANIMAL);
eventWriter.add(eElement);
eventWriter.add(end);
}
eventWriter.add(eventFactory.createEndElement("", "", "content"));
eventWriter.add(eventFactory.createEndDocument());
eventWriter.close();
}
示例15: save
import javax.xml.stream.XMLEventFactory; //导入方法依赖的package包/类
public void save(ArrayList<Employee> employees) throws FileNotFoundException, XMLStreamException {
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
// Create XMLEventWriter
XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(new FileOutputStream(XML_FILENAME));
// Create a EventFactory
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
// Create and write Start Tag
StartDocument startDocument = eventFactory.createStartDocument();
eventWriter.add(startDocument);
// Create content open tag
StartElement configStartElement = eventFactory.createStartElement("", "", "content");
eventWriter.add(configStartElement);
eventWriter.add(end);
for (XML_Parsable employee : employees) {
StartElement sElement = eventFactory.createStartElement("", "", Constants.XML_TAGS.EMPLOYEE);
eventWriter.add(sElement);
eventWriter.add(end);
employee.encodeToXml(eventWriter);
EndElement eElement = eventFactory.createEndElement("", "", Constants.XML_TAGS.EMPLOYEE);
eventWriter.add(eElement);
eventWriter.add(end);
}
eventWriter.add(eventFactory.createEndElement("", "", "content"));
eventWriter.add(eventFactory.createEndDocument());
eventWriter.close();
}