List of usage examples for javax.xml.stream XMLStreamWriter writeCharacters
public void writeCharacters(String text) throws XMLStreamException;
From source file:com.norconex.committer.gsa.GsaCommitter.java
@Override protected void saveToXML(XMLStreamWriter writer) throws XMLStreamException { writer.writeStartElement("feedUrl"); writer.writeCharacters(getFeedUrl()); writer.writeEndElement();//from w ww . ja va 2 s. c o m }
From source file:gdv.xport.util.HtmlFormatter.java
private static void writeTo(final XMLStreamWriter xmlStreamWriter, final Satz satz, final int zeile) throws XMLStreamException { xmlStreamWriter.writeStartElement("div"); xmlStreamWriter.writeAttribute("class", "Satz"); if (satz instanceof Datensatz) { Datensatz datensatz = (Datensatz) satz; xmlStreamWriter.writeAttribute("title", "Satzart " + datensatz.getSatzartFeld().getInhalt() + "." + datensatz.getSparteFeld().getInhalt()); } else {//from ww w . j av a 2 s .c o m xmlStreamWriter.writeAttribute("title", "Satzart " + satz.getSatzartFeld().getInhalt()); } int n = zeile; for (Iterator<Teildatensatz> iterator = satz.getTeildatensaetze().iterator(); iterator.hasNext();) { Teildatensatz teildatensatz = iterator.next(); writeTo(xmlStreamWriter, teildatensatz, n); if (iterator.hasNext()) { xmlStreamWriter.writeCharacters("\n"); } n++; } xmlStreamWriter.writeEndElement(); xmlStreamWriter.writeCharacters("\n"); xmlStreamWriter.flush(); }
From source file:org.unitedinternet.cosmo.dav.CosmoDavException.java
protected void writeContent(XMLStreamWriter writer) throws XMLStreamException { writer.writeStartElement(NS_COSMO, "internal-server-error"); if (getMessage() != null) { writer.writeCharacters(getMessage()); }/*from w w w . j ava2 s . c om*/ writer.writeEndElement(); }
From source file:org.maodian.flyingcat.xmpp.codec.BindCodec.java
@Override public void encode(Object object, XMLStreamWriter xmlsw) throws XMLStreamException { Bind bind = (Bind) object;// www.j av a 2 s . co m xmlsw.writeStartElement("bind"); xmlsw.writeDefaultNamespace(XmppNamespace.BIND); xmlsw.writeStartElement("jid"); xmlsw.writeCharacters(bind.getJabberId()); xmlsw.writeEndElement(); xmlsw.writeEndElement(); }
From source file:com.pocketsoap.salesforce.soap.SoapRequestEntity.java
protected void writeElementString(XMLStreamWriter w, String elemNamespace, String elemName, String elemValue) throws XMLStreamException { if (elemValue == null) return;//from w w w. jav a 2 s . c o m w.writeStartElement(elemNamespace, elemName); w.writeCharacters(elemValue); w.writeEndElement(); }
From source file:de.qucosa.webapi.v1.RelationResource.java
private void writeRelationElement(List<Tuple<String>> tuples, XMLStreamWriter w, String name, String type) throws XMLStreamException { for (Tuple<String> t : tuples) { w.writeStartElement(name);// www. ja va2s . co m w.writeStartElement("DocumentId"); w.writeCharacters(t.get(0)); w.writeEndElement(); w.writeStartElement("Value"); w.writeCharacters(t.get(1)); w.writeEndElement(); w.writeStartElement("Relation"); w.writeCharacters(type); w.writeEndElement(); w.writeStartElement("TitleMain"); w.writeCharacters(t.get(2)); w.writeEndElement(); w.writeEmptyElement("Label"); w.writeEmptyElement("SortOrder"); w.writeEmptyElement("Issue"); w.writeEndElement(); } }
From source file:com.norconex.collector.http.checksum.impl.DefaultHttpDocumentChecksummer.java
@Override public void saveToXML(Writer out) throws IOException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); try {/*w w w . j a v a 2s . c o m*/ 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:net.danizen.norconex.committer.kafka.KafkaCommitter.java
@Override protected void saveToXML(XMLStreamWriter writer) throws XMLStreamException { if (StringUtils.isNotBlank(topicName)) { writer.writeStartElement("topicName"); writer.writeCharacters(topicName); writer.writeEndElement();//from w w w .j a va 2 s.co m } if (StringUtils.isNotBlank(brokerList)) { writer.writeStartElement("brokerList"); writer.writeCharacters(brokerList); writer.writeEndElement(); } }
From source file:de.qucosa.webapi.v1.RelationResource.java
@RequestMapping(value = "/relation/urn/{URN}", method = RequestMethod.GET) public ResponseEntity<String> describeRelationships(@PathVariable String URN) throws XMLStreamException, IOException, FedoraClientException { String pid = fedoraRepository.getPIDByIdentifier(URN); List<Tuple<String>> constituentPredecessorPids = fedoraRepository.getPredecessorPIDs(pid, FedoraRepository.RELATION_CONSTITUENT); List<Tuple<String>> derivativePredecessorPIDs = fedoraRepository.getPredecessorPIDs(pid, FedoraRepository.RELATION_DERIVATIVE); List<Tuple<String>> constituentSuccessorPids = fedoraRepository.getSuccessorPIDs(pid, FedoraRepository.RELATION_CONSTITUENT); List<Tuple<String>> derivativeSuccessorPids = fedoraRepository.getSuccessorPIDs(pid, FedoraRepository.RELATION_DERIVATIVE); XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newFactory(); StringWriter sw = new StringWriter(); XMLStreamWriter w = xmlOutputFactory.createXMLStreamWriter(sw); w.writeStartDocument("UTF-8", "1.0"); w.writeStartElement("Opus"); w.writeStartElement("Opus_Document"); w.writeStartElement("DocumentId"); w.writeCharacters(stripPrefix(pid)); w.writeEndElement();/*from w ww .ja v a2 s . com*/ w.writeStartElement("Relations"); writeRelationElement(constituentPredecessorPids, w, "PredecessorRelation", "journal"); writeRelationElement(derivativePredecessorPIDs, w, "PredecessorRelation", "predecessor"); writeRelationElement(constituentSuccessorPids, w, "SuccessorRelation", "issue"); writeRelationElement(derivativeSuccessorPids, w, "SuccessorRelation", "predecessor"); w.writeEndElement(); w.writeEndElement(); w.writeEndElement(); w.writeEndDocument(); w.flush(); return new ResponseEntity<>(sw.toString(), HttpStatus.OK); }
From source file:com.predic8.membrane.core.http.xml.Response.java
@Override public void write(XMLStreamWriter out) throws XMLStreamException { out.writeStartElement("http", ELEMENT_NAME, Constants.HTTP_NS); out.writeNamespace("http", Constants.HTTP_NS); out.writeStartElement("status"); out.writeAttribute("code", "" + statusCode); out.writeCharacters(statusMessage); out.writeEndElement();//w w w . j ava2 s . c o m writeIfNotNull(headers, out); if (body != null) { out.writeStartElement("body"); body.write(out); out.writeEndElement(); } out.writeEndElement(); }