List of usage examples for javax.xml.stream XMLStreamWriter writeEndElement
public void writeEndElement() throws XMLStreamException;
From source file:com.norconex.collector.core.filter.impl.ExtensionReferenceFilter.java
@Override public void saveToXML(Writer out) throws IOException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); try {/*from w w w. j a va 2 s.c om*/ XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartElement("filter"); writer.writeAttribute("class", getClass().getCanonicalName()); saveToXML(writer); writer.writeAttribute("caseSensitive", Boolean.toString(caseSensitive)); writer.writeCharacters(extensions); writer.writeEndElement(); writer.flush(); writer.close(); } catch (XMLStreamException e) { throw new IOException("Cannot save as XML.", e); } }
From source file:DDTReporter.java
private void writeEndElement(XMLStreamWriter writer) throws XMLStreamException { writer.writeEndElement(); writer.writeCharacters("\n"); }
From source file:com.adobe.acs.commons.wcm.impl.SiteMapServlet.java
private void writeElement(final XMLStreamWriter stream, final String elementName, final String text) throws XMLStreamException { stream.writeStartElement(NS, elementName); stream.writeCharacters(text);/*from w w w. j a va 2 s . co m*/ stream.writeEndElement(); }
From source file:com.norconex.collector.core.filter.impl.RegexReferenceFilter.java
@Override public void saveToXML(Writer out) throws IOException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); try {//from w ww .ja v a 2 s . c om XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartElement("filter"); writer.writeAttribute("class", getClass().getCanonicalName()); super.saveToXML(writer); writer.writeAttribute("caseSensitive", Boolean.toString(caseSensitive)); writer.writeCharacters(regex == null ? "" : regex); writer.writeEndElement(); writer.flush(); writer.close(); } catch (XMLStreamException e) { throw new IOException("Cannot save as XML.", e); } }
From source file:de.shadowhunt.subversion.internal.ResolveOperation.java
@Override protected HttpUriRequest createRequest() { final Writer body = new StringBuilderWriter(); try {//w w w . j av a2s. co m final XMLStreamWriter writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(body); writer.writeStartDocument(XmlConstants.ENCODING, XmlConstants.VERSION_1_0); writer.writeStartElement("get-locations"); writer.writeDefaultNamespace(XmlConstants.SVN_NAMESPACE); writer.writeEmptyElement("path"); writer.writeStartElement("peg-revision"); writer.writeCharacters(revision.toString()); writer.writeEndElement(); // peg-revision writer.writeStartElement("location-revision"); writer.writeCharacters(expected.toString()); writer.writeEndElement(); // location-revision writer.writeEndElement(); //get-locations writer.writeEndDocument(); writer.close(); } catch (final XMLStreamException e) { throw new SubversionException("could not create request body", e); } final URI uri = URIUtils.createURI(repository, resource); final DavTemplateRequest request = new DavTemplateRequest("REPORT", uri); request.setEntity(new StringEntity(body.toString(), CONTENT_TYPE_XML)); return request; }
From source file:com.norconex.collector.http.robot.impl.DefaultRobotsMetaProvider.java
@Override public void saveToXML(Writer out) throws IOException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); try {//from ww w . j a v a 2 s . c o m XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartElement("robotsMeta"); writer.writeAttribute("class", getClass().getCanonicalName()); writer.writeStartElement("headersPrefix"); if (headersPrefix != null) { writer.writeCharacters(headersPrefix); } writer.writeEndElement(); writer.writeEndElement(); writer.flush(); writer.close(); } catch (XMLStreamException e) { throw new IOException("Cannot save as XML.", e); } }
From source file:com.fiorano.openesb.application.common.Param.java
public void toJXMLString(XMLStreamWriter writer) throws XMLStreamException { //Start Param writer.writeStartElement("Param"); writer.writeAttribute("name", m_paramName); writer.writeCharacters(m_paramValue); //End Param//from w ww.java 2s . c o m writer.writeEndElement(); }
From source file:com.norconex.collector.http.client.impl.DefaultHttpClientInitializer.java
private void writeSimpleElement(XMLStreamWriter writer, String name, String value) throws XMLStreamException { writer.writeStartElement(name);//from w w w . j a v a 2s . c o m writer.writeCharacters(value); writer.writeEndElement(); }
From source file:com.pocketsoap.salesforce.soap.SoapRequestEntity.java
public final void writeRequest(OutputStream out) throws IOException { XMLOutputFactory f = XMLOutputFactory.newInstance(); try {// w ww . j a v a 2s . c o m XMLStreamWriter w = f.createXMLStreamWriter(new BufferedOutputStream(out, 1024), "UTF-8"); w.writeStartDocument(); w.writeStartElement("s", "Envelope", SOAP_NS); w.writeNamespace("s", SOAP_NS); w.writeNamespace("p", PARTNER_NS); w.setPrefix("p", PARTNER_NS); w.setPrefix("s", SOAP_NS); if (hasHeaders()) { w.writeStartElement(SOAP_NS, "Header"); writeHeaders(w); w.writeEndElement(); } w.writeStartElement(SOAP_NS, "Body"); writeBody(w); w.writeEndElement();//body w.writeEndElement();//envelope w.writeEndDocument(); w.close(); } catch (XMLStreamException e) { throw new IOException("Error generating request xml", e); } }
From source file:com.norconex.jef4.status.FileJobStatusStore.java
@Override public void saveToXML(Writer out) throws IOException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); try {//from w w w. j av a 2 s . c o m XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartElement("statusStore"); writer.writeAttribute("class", getClass().getCanonicalName()); writer.writeStartElement("statusDir"); writer.writeCharacters(new File(statusDir).getAbsolutePath()); writer.writeEndElement(); writer.writeEndElement(); writer.flush(); writer.close(); } catch (XMLStreamException e) { throw new IOException("Cannot save as XML.", e); } }