List of usage examples for javax.xml.stream XMLStreamWriter writeAttribute
public void writeAttribute(String localName, String value) throws XMLStreamException;
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();/* w w w. j av a2s .com*/ }
From source file:com.predic8.membrane.core.config.Proxy.java
@Override public void write(XMLStreamWriter out) throws XMLStreamException { out.writeStartElement(ELEMENT_NAME); out.writeAttribute(ATTRIBUTE_ACTIVE, Boolean.toString(useProxy)); out.writeAttribute(ATTRIBUTE_AUTHENTICATION, Boolean.toString(useAuthentication)); new ProxyHost(proxyHost).write(out); new ProxyPort(Integer.toString(proxyPort)).write(out); new ProxyUsername(proxyUsername).write(out); new ProxyPassword(proxyPassword).write(out); out.writeEndElement();// w w w. j av a 2 s . c om }
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 va 2 s. 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:com.norconex.collector.http.sitemap.impl.StandardSitemapResolverFactory.java
@Override public void saveToXML(Writer out) throws IOException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); try {/* ww w. ja v a 2 s. c o m*/ XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartElement("sitemapResolverFactory"); writer.writeAttribute("class", getClass().getCanonicalName()); writer.writeAttribute("lenient", Boolean.toString(lenient)); if (sitemapLocations != null) { for (String location : sitemapLocations) { writer.writeStartElement("location"); writer.writeCharacters(location); writer.writeEndElement(); } } writer.writeEndElement(); writer.flush(); writer.close(); } catch (XMLStreamException e) { throw new IOException("Cannot save as XML.", e); } }
From source file:com.norconex.collector.http.fetch.impl.GenericMetadataFetcher.java
@Override public void saveToXML(Writer out) throws IOException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); try {/*w w w . j av a 2 s . c o m*/ XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartElement("httpHeadersFetcher"); writer.writeAttribute("class", getClass().getCanonicalName()); writer.writeStartElement("validStatusCodes"); writer.writeCharacters(StringUtils.join(validStatusCodes, ",")); writer.writeEndElement(); writer.writeStartElement("headersPrefix"); 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.github.fritaly.graphml4j.GroupStyle.java
private void writeInsets(XMLStreamWriter writer) throws XMLStreamException { Validate.notNull(writer, "The given stream writer is null"); writer.writeEmptyElement("y:BorderInsets"); writer.writeAttribute("bottom", String.format("%.0f", insets)); writer.writeAttribute("bottomF", String.format("%.1f", insets)); writer.writeAttribute("left", String.format("%.0f", insets)); writer.writeAttribute("leftF", String.format("%.1f", insets)); writer.writeAttribute("right", String.format("%.0f", insets)); writer.writeAttribute("rightF", String.format("%.1f", insets)); writer.writeAttribute("top", String.format("%.0f", insets)); writer.writeAttribute("topF", String.format("%.1f", insets)); }
From source file:com.github.fritaly.graphml4j.ShapeStyle.java
private void writeShape(XMLStreamWriter writer) throws XMLStreamException { Validate.notNull(writer, "The given stream writer is null"); // y:Shape//ww w. j a v a2 s . co m writer.writeEmptyElement("y:Shape"); writer.writeAttribute("type", shape.getValue()); }
From source file:com.norconex.collector.core.filter.impl.RegexReferenceFilter.java
@Override public void saveToXML(Writer out) throws IOException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); try {//ww w.j a 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:com.github.fritaly.graphml4j.GroupStyle.java
private void writeState(XMLStreamWriter writer, boolean closed) throws XMLStreamException { Validate.notNull(writer, "The given stream writer is null"); writer.writeEmptyElement("y:State"); writer.writeAttribute("closed", Boolean.toString(closed)); writer.writeAttribute("closedHeight", String.format("%.1f", 50.0f)); // TODO Create property for closedHeight writer.writeAttribute("closedWidth", String.format("%.1f", 50.0f)); // TODO Create property for closedWidth // Infer the property innerGraphDisplayEnabled from the closed flag writer.writeAttribute("innerGraphDisplayEnabled", Boolean.toString(!closed)); }
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 www . j a v a2s . c o m*/ 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); } }