List of usage examples for javax.xml.stream XMLStreamWriter writeStartElement
public void writeStartElement(String localName) throws XMLStreamException;
From source file:com.fiorano.openesb.application.DmiObject.java
protected static void writeElement(XMLStreamWriter writer, String element, String content) throws XMLStreamException { if (!StringUtils.isEmpty(content)) { writer.writeStartElement(element); writer.writeCharacters(content); writer.writeEndElement();/*ww w. j a v a2 s .c o m*/ } }
From source file:com.fiorano.openesb.application.DmiObject.java
protected static void writeCDATAElement(XMLStreamWriter writer, String element, String content) throws XMLStreamException { if (!StringUtils.isEmpty(content)) { writer.writeStartElement(element); writer.writeCData(content);//from w w w. j a v a 2 s . co m writer.writeEndElement(); } }
From source file:com.predic8.membrane.core.interceptor.balancer.JSESSIONIDExtractor.java
@Override public void write(XMLStreamWriter out) throws XMLStreamException { out.writeStartElement("jSessionIdExtractor"); out.writeEndElement();//from w ww .j a v a 2 s. co m }
From source file:com.fiorano.openesb.application.DmiObject.java
protected static void writeCollection(XMLStreamWriter writer, Collection/*<DmiObject>*/ c, String element, boolean writeCDataSections) throws XMLStreamException, FioranoException { if (c.size() > 0) { if (element != null) writer.writeStartElement(element); for (Object obj : c) { DmiObject dmi = (DmiObject) obj; dmi.toJXMLString(writer, writeCDataSections); }//from w w w . ja va 2 s. co m if (element != null) writer.writeEndElement(); } }
From source file:com.predic8.membrane.core.interceptor.cbr.Case.java
@Override public void write(XMLStreamWriter out) throws XMLStreamException { out.writeStartElement("case"); out.writeAttribute("xPath", xPath); out.writeAttribute("url", url); out.writeEndElement();/* w ww . j a v a 2 s .c o m*/ }
From source file:com.predic8.membrane.core.interceptor.balancer.XMLElementSessionIdExtractor.java
@Override public void write(XMLStreamWriter out) throws XMLStreamException { out.writeStartElement("xmlSessionIdExtractor"); out.writeAttribute("localName", localName); out.writeAttribute("namespace", namespace); out.writeEndElement();//from ww w . j a va 2 s .co m }
From source file:org.maodian.flyingcat.xmpp.codec.BindCodec.java
@Override public void encode(Object object, XMLStreamWriter xmlsw) throws XMLStreamException { Bind bind = (Bind) object;/*from ww w . j av a 2s.c o m*/ xmlsw.writeStartElement("bind"); xmlsw.writeDefaultNamespace(XmppNamespace.BIND); xmlsw.writeStartElement("jid"); xmlsw.writeCharacters(bind.getJabberId()); xmlsw.writeEndElement(); xmlsw.writeEndElement(); }
From source file:jodtemplate.pptx.io.xml.SlideXmlRelsWriter.java
@Override public void write(final Resources resources, final Slide slide, final XMLOutputFactory xmlOutputFactory) throws XMLStreamException, IOException { final String slideXmlPath = FilenameUtils .normalize(slide.getPresentation().getFullPath() + slide.getRelationship().getTarget(), true); final String slideXmlRelsPath = Utils.getRelsPathNoPrefixSeparator(slideXmlPath); final Resource slideXmlRelsRes = resources.getResource(slideXmlRelsPath); try (final OutputStream os = slideXmlRelsRes.getOutputStream()) { os.write(/*from w w w .j a v a2 s . c o m*/ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n".getBytes(CharEncoding.UTF_8)); final XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(os); writer.writeStartElement(OOXMLDocument.RELATIONSHIPS_ELEMENT); writer.writeNamespace("", OOXMLDocument.RELATIONSHIPS_RELS_NAMESPACE); for (Relationship rel : slide.getOtherRelationships()) { writer.writeEmptyElement(OOXMLDocument.RELATIONSHIPS_RELS_NAMESPACE, OOXMLDocument.RELATIONSHIP_ELEMENT); writer.writeAttribute(OOXMLDocument.RELATIONSHIPS_RELS_NAMESPACE, OOXMLDocument.ID_ATTRIBUTE, rel.getId()); writer.writeAttribute(OOXMLDocument.RELATIONSHIPS_RELS_NAMESPACE, OOXMLDocument.TYPE_ATTRIBUTE, rel.getType()); writer.writeAttribute(OOXMLDocument.RELATIONSHIPS_RELS_NAMESPACE, OOXMLDocument.TARGET_ATTRIBUTE, rel.getTarget()); if (StringUtils.isNotBlank(rel.getTargetMode())) { writer.writeAttribute(OOXMLDocument.RELATIONSHIPS_RELS_NAMESPACE, OOXMLDocument.TARGET_MODE_ATTRIBUTE, rel.getTargetMode()); } writer.flush(); } writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); writer.close(); } }
From source file:com.norconex.collector.http.checksum.impl.DefaultHttpDocumentChecksummer.java
@Override public void saveToXML(Writer out) throws IOException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); try {/*from w w w .j ava2 s . c om*/ XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartElement("httpDocumentChecksummer"); writer.writeAttribute("class", getClass().getCanonicalName()); writer.writeStartElement("field"); writer.writeCharacters(field); writer.writeEndElement(); writer.writeEndElement(); writer.flush(); writer.close(); } catch (XMLStreamException e) { throw new IOException("Cannot save as XML.", e); } }
From source file:org.maodian.flyingcat.xmpp.codec.InfoQueryCodec.java
@Override public void encode(Object object, XMLStreamWriter xmlsw) throws XMLStreamException { InfoQuery iq = (InfoQuery) object;//w ww. j ava2 s. co m xmlsw.writeStartElement("iq"); writeRequiredAttribute(xmlsw, "id", iq.getId()); writeRequiredAttribute(xmlsw, "type", iq.getType()); writeAttributeIfNotBlank(xmlsw, "from", iq.getFrom()); writeAttributeIfNotBlank(xmlsw, "to", iq.getTo()); writeAttributeIfNotBlank(xmlsw, XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI, "lang", iq.getLanguage()); Object payload = iq.getPayload(); if (payload != null) { Encoder encoder = findEncoder(payload.getClass()); encoder.encode(payload, xmlsw); } xmlsw.writeEndDocument(); }