public StaxSerializer(XMLStreamWriter writer, boolean indenting) { if(indenting) writer = new IndentingXMLStreamWriter(writer); this.out = writer; }
public StaxSerializer(XMLStreamWriter writer, boolean indenting) { if(indenting) writer = new IndentingXMLStreamWriter(writer); this.out = writer; }
public StaxSerializer(XMLStreamWriter writer, boolean indenting) { if(indenting) writer = new IndentingXMLStreamWriter(writer); this.out = writer; }
public StaxSerializer(XMLStreamWriter writer, boolean indenting) { if(indenting) writer = new IndentingXMLStreamWriter(writer); this.out = writer; }
public StaxSerializer(XMLStreamWriter writer, boolean indenting) { if(indenting) writer = new IndentingXMLStreamWriter(writer); this.out = writer; }
@Override public void run() throws XMLStreamException, IOException { OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(xmlReportFile), ENCODING); XMLStreamWriter streamWriter= xmlOutputFactory.createXMLStreamWriter(writer); xmlStreamWriter = new IndentingXMLStreamWriter(streamWriter); xmlStreamWriter.writeStartDocument(ENCODING, "1.0"); xmlStreamWriter.setPrefix(NAMESPACE_PREFIX, NAMESPACE_URL); xmlStreamWriter.writeStartElement(NAMESPACE_URL, "jqassistant-report"); xmlStreamWriter.writeNamespace(NAMESPACE_PREFIX, NAMESPACE_URL); } });
public OSMXMLWriter (File outFile) { try { outFile.getParentFile().mkdirs(); os = new FileOutputStream(outFile); this.out = XMLOutputFactory.newInstance().createXMLStreamWriter( new OutputStreamWriter(os, "utf-8")); this.out = new IndentingXMLStreamWriter(this.out); out.writeStartDocument(); // OSM out.writeStartElement("osm"); out.writeAttribute("version", "0.6"); out.writeAttribute("generator", "OSM-Gazetter-tiler " + Versions.gazetteer); } catch (Exception e) { throw new RuntimeException(e); } }
@SuppressWarnings("unchecked") public <T extends PrideXmlObject> void marshall(T object, XMLStreamWriter xmlStreamWriter) { if (object == null) { throw new IllegalArgumentException("Cannot marshall a NULL object"); } try { // Set JAXB_FRAGMENT_PROPERTY to true for all objects that do not have a @XmlRootElement annotation if (!(object instanceof ExperimentCollection)) { marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); } else { marshaller.setProperty(Marshaller.JAXB_FRAGMENT, false); } QName aQName = ModelConstants.getQNameForClass(object.getClass()); // before marshalling out, wrap in a Custom XMLStreamWriter // to fix a JAXB bug: http://java.net/jira/browse/JAXB-614 // also wrapping in IndentingXMLStreamWriter to generate formatted XML IndentingXMLStreamWriter writer = new IndentingXMLStreamWriter(new EscapingXMLStreamWriter(xmlStreamWriter)); marshaller.marshal(new JAXBElement(aQName, object.getClass(), object), writer); } catch (JAXBException e) { logger.error("PrideXmlMarshaller.marshall", e); throw new IllegalStateException("Error while marshalling object:" + object.toString()); } }
private void marshal(Writer writer, JqassistantRules rules) throws RuleException { XMLOutputFactory xof = XMLOutputFactory.newInstance(); XMLStreamWriter streamWriter; try { streamWriter = xof.createXMLStreamWriter(writer); } catch (XMLStreamException e) { throw new RuleException("Cannot create stream writer.", e); } XMLStreamWriter indentingStreamWriter = new IndentingXMLStreamWriter(new CDataXMLStreamWriter(streamWriter)); try { Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); marshaller.marshal(rules, indentingStreamWriter); } catch (JAXBException e) { throw new RuleException("Cannot write rules to " + writer, e); } }
XMLOutputFactory output = XMLOutputFactory.newInstance(); XMLStreamWriter writer = new IndentingXMLStreamWriter( output.createXMLStreamWriter(fileStream, "utf-8")); try {
private void init(Result result, boolean indent) { try { XMLOutputFactory factory = XMLOutputFactory.newFactory(); writer = factory.createXMLStreamWriter(result); if (indent) { IndentingXMLStreamWriter indenter = new IndentingXMLStreamWriter(writer); indenter.setIndentStep(" "); writer = indenter; } } catch (XMLStreamException exception) { throw new XmlException("Can't create XML writer", exception); } }
XMLOutputFactory output = XMLOutputFactory.newInstance(); XMLStreamWriter writer = new IndentingXMLStreamWriter( output.createXMLStreamWriter(fileStream, "utf-8")); try {
XMLStreamWriter xmlStreamWriter = factory.createXMLStreamWriter(out); IndentingXMLStreamWriter writer = new IndentingXMLStreamWriter(new EscapingXMLStreamWriter(xmlStreamWriter)); marshaller.marshal( new JAXBElement(aQName, object.getClass(), object), writer );
public void open(OutputStream outputStream, int numberOfResults) throws XMLStreamException, IOException, JAXBException { xmlOut = new IndentingXMLStreamWriter(XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream)); xmlOut.setDefaultNamespace("http://www.cs.rpi.edu/XGMML"); xmlOut.setNamespaceContext(new NamespaceContext() { public Iterator getPrefixes(String namespaceURI) { return null; } public String getPrefix(String namespaceURI) { return ""; } public String getNamespaceURI(String prefix) { return null; } }); this.attributeStreamBuilder.setXmlOut(xmlOut); this.nodeStreamBuilder.setXmlOut(xmlOut); this.edgeStreamBuilder.setXmlOut(xmlOut); xmlOut.writeStartDocument(); xmlOut.writeStartElement("http://www.cs.rpi.edu/XGMML", "graph"); xmlOut.writeDefaultNamespace("http://www.cs.rpi.edu/XGMML"); xmlOut.writeNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); xmlOut.writeNamespace("dc", "http://purl.org/dc/elements/1.1/"); xmlOut.writeNamespace("xlink", "http://www.w3.org/1999/xlink"); xmlOut.writeNamespace("cy", "http://www.cytoscape.org"); createdStartGraph(numberOfResults); xmlOut.flush(); }
IndentingXMLStreamWriter writer = new IndentingXMLStreamWriter(new EscapingXMLStreamWriter(xmlStreamWriter, encoding));
IndentingXMLStreamWriter indentingWriter = new IndentingXMLStreamWriter(xsw); wsdlPatcher.bridge(xsr, indentingWriter); options.addGeneratedFile(outFile);
IndentingXMLStreamWriter indentingWriter = new IndentingXMLStreamWriter(xsw); wsdlPatcher.bridge(xsr, indentingWriter); options.addGeneratedFile(outFile);
IndentingXMLStreamWriter indentingWriter = new IndentingXMLStreamWriter(xsw); wsdlPatcher.bridge(xsr, indentingWriter); options.addGeneratedFile(outFile);
IndentingXMLStreamWriter indentingWriter = new IndentingXMLStreamWriter(xsw); wsdlPatcher.bridge(xsr, indentingWriter); options.addGeneratedFile(outFile);
void write(Result<?> result, SubGraph graph, File file) throws IOException, XMLStreamException { try (PrintWriter writer = new PrintWriter(new FileWriter(file)); GraphMLDecorator decorator = getGraphMLDecorator(result)) { XMLStreamWriter xmlWriter = new IndentingXMLStreamWriter(xmlOutputFactory.createXMLStreamWriter(writer)); decorator.initialize(result, graph, xmlWriter, file, properties); GraphMLNamespaceContext context = new GraphMLNamespaceContext(decorator.getNamespaces(), decorator.getSchemaLocations()); xmlWriter.setNamespaceContext(context); writeHeader(xmlWriter, context); Collection<Node> nodes = getAllNodes(graph); Collection<Relationship> relationships = getAllRelationships(graph); writeKeyTypes(xmlWriter, nodes, relationships); decorator.writeKeys(); writeSubgraph(graph, xmlWriter, decorator); // filter and write edges Set<Long> allNodeIds = new HashSet<>(); for (Node node : nodes) { allNodeIds.add(node.getId()); } for (Relationship relationship : relationships) { long startId = relationship.getStartNode().getId(); long endId = relationship.getEndNode().getId(); if (allNodeIds.contains(startId) && allNodeIds.contains(endId)) { writeRelationship(xmlWriter, decorator, relationship); } } writeFooter(xmlWriter); decorator.close(); } }