Java Code Examples for javax.xml.transform.stream.StreamResult#setSystemId()
The following examples show how to use
javax.xml.transform.stream.StreamResult#setSystemId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestStreamResult.java From woodstox with Apache License 2.0 | 6 votes |
/** * This test is related to problem reported as [WSTX-182], inability * to use SystemId alone as source. */ public void testCreateUsingSystemId() throws IOException, XMLStreamException { File tmpF = File.createTempFile("staxtest", ".xml"); tmpF.deleteOnExit(); XMLOutputFactory f = getOutputFactory(); StreamResult dst = new StreamResult(); dst.setSystemId(tmpF); XMLStreamWriter sw = f.createXMLStreamWriter(dst); sw.writeStartDocument(); sw.writeEmptyElement("root"); sw.writeEndDocument(); sw.close(); // plus let's read and check it XMLInputFactory2 inf = getInputFactory(); XMLStreamReader sr = inf.createXMLStreamReader(tmpF); assertTokenType(START_ELEMENT, sr.next()); assertTokenType(END_ELEMENT, sr.next()); sr.close(); }
Example 2
Source File: DefaultToolingXMLService.java From windup with Eclipse Public License 1.0 | 6 votes |
@Override public void generateSchema(Path outputPath) { try { JAXBContext jaxbContext = getJAXBContext(); SchemaOutputResolver sor = new SchemaOutputResolver() { @Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { StreamResult result = new StreamResult(); result.setSystemId(outputPath.toUri().toString()); return result; } }; jaxbContext.generateSchema(sor); } catch (JAXBException | IOException e) { throw new WindupException("Error generating Windup schema due to: " + e.getMessage(), e); } }
Example 3
Source File: XMLOutputFactoryImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** StreamResult object is re-used and the values are set appropriately. */ StreamResult toStreamResult(OutputStream os, Writer writer, String systemId){ StreamResult sr = new StreamResult(); sr.setOutputStream(os); sr.setWriter(writer); sr.setSystemId(systemId); return sr; }
Example 4
Source File: XMLOutputFactoryImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** StreamResult object is re-used and the values are set appropriately. */ StreamResult toStreamResult(OutputStream os, Writer writer, String systemId){ StreamResult sr = new StreamResult(); sr.setOutputStream(os); sr.setWriter(writer); sr.setSystemId(systemId); return sr; }
Example 5
Source File: StringSchemaOutputResolver.java From aion-germany with GNU General Public License v3.0 | 5 votes |
@Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { sw = new StringWriter(); StreamResult sr = new StreamResult(); // If it's not set - schemagen throws AssertionError sr.setSystemId(String.valueOf(System.currentTimeMillis())); sr.setWriter(sw); return sr; }
Example 6
Source File: XMLOutputFactoryImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** StreamResult object is re-used and the values are set appropriately. */ StreamResult toStreamResult(OutputStream os, Writer writer, String systemId){ StreamResult sr = new StreamResult(); sr.setOutputStream(os); sr.setWriter(writer); sr.setSystemId(systemId); return sr; }
Example 7
Source File: XMLOutputFactoryImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** StreamResult object is re-used and the values are set appropriately. */ StreamResult toStreamResult(OutputStream os, Writer writer, String systemId){ StreamResult sr = new StreamResult(); sr.setOutputStream(os); sr.setWriter(writer); sr.setSystemId(systemId); return sr; }
Example 8
Source File: XMLOutputFactoryImpl.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * StreamResult object is re-used and the values are set appropriately. */ StreamResult toStreamResult(OutputStream os, Writer writer, String systemId) { StreamResult sr = new StreamResult(); sr.setOutputStream(os); sr.setWriter(writer); sr.setSystemId(systemId); return sr; }
Example 9
Source File: XMLOutputFactoryImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** StreamResult object is re-used and the values are set appropriately. */ StreamResult toStreamResult(OutputStream os, Writer writer, String systemId){ StreamResult sr = new StreamResult(); sr.setOutputStream(os); sr.setWriter(writer); sr.setSystemId(systemId); return sr; }
Example 10
Source File: XMLOutputFactoryImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** StreamResult object is re-used and the values are set appropriately. */ StreamResult toStreamResult(OutputStream os, Writer writer, String systemId){ StreamResult sr = new StreamResult(); sr.setOutputStream(os); sr.setWriter(writer); sr.setSystemId(systemId); return sr; }
Example 11
Source File: XMLOutputFactoryImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** StreamResult object is re-used and the values are set appropriately. */ StreamResult toStreamResult(OutputStream os, Writer writer, String systemId){ StreamResult sr = new StreamResult(); sr.setOutputStream(os); sr.setWriter(writer); sr.setSystemId(systemId); return sr; }
Example 12
Source File: XMLOutputFactoryImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** StreamResult object is re-used and the values are set appropriately. */ StreamResult toStreamResult(OutputStream os, Writer writer, String systemId){ StreamResult sr = new StreamResult(); sr.setOutputStream(os); sr.setWriter(writer); sr.setSystemId(systemId); return sr; }
Example 13
Source File: DevelopmentGenerateJaxbSchema.java From settlers-remake with MIT License | 5 votes |
public static void main(String[] args) throws JAXBException, IOException { JAXBContext jaxbContext = JAXBContext.newInstance(Presets.class); SchemaOutputResolver sor = new SchemaOutputResolver() { @Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { File file = new File("src/jsettlers/mapcreator/presetloader/preset.xsd"); StreamResult result = new StreamResult(file); result.setSystemId(file.toURI().toURL().toString()); return result; } }; jaxbContext.generateSchema(sor); System.out.println("Finished!"); }
Example 14
Source File: ProjectSchemaWriter.java From importer-exporter with Apache License 2.0 | 5 votes |
@Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { Path file = namespaceUri.equals("http://www.3dcitydb.org/importer-exporter/config") ? targetDir.resolve("config.xsd") : targetDir.resolve("plugin_" + suggestedFileName); StreamResult res = new StreamResult(file.toFile()); res.setSystemId(URLDecoder.decode(file.toUri().toURL().toString(), StandardCharsets.UTF_8.name())); return res; }
Example 15
Source File: GenerateExtensionManifestSchema.java From nifi-registry with Apache License 2.0 | 4 votes |
public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { File file = new File("./target", suggestedFileName); StreamResult result = new StreamResult(file); result.setSystemId(file.toURI().toURL().toString()); return result; }
Example 16
Source File: StreamSchemaOutputResolver.java From entando-core with GNU Lesser General Public License v3.0 | 4 votes |
public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { StreamResult result = new StreamResult(this.getOs()); result.setSystemId(suggestedFileName); return result; }