Java Code Examples for javax.xml.transform.dom.DOMResult#setSystemId()

The following examples show how to use javax.xml.transform.dom.DOMResult#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: DynamicSchemaTest.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test(expected = MarshalException.class)
public void generatesAndUsesSchema() throws JAXBException, IOException,
		SAXException {
	final JAXBContext context = JAXBContext.newInstance(A.class);
	final DOMResult result = new DOMResult();
	result.setSystemId("schema.xsd");
	context.generateSchema(new SchemaOutputResolver() {
		@Override
		public Result createOutput(String namespaceUri,
				String suggestedFileName) {
			return result;
		}
	});

	@SuppressWarnings("deprecation")
	final SchemaFactory schemaFactory = SchemaFactory
			.newInstance(WellKnownNamespace.XML_SCHEMA);
	final Schema schema = schemaFactory.newSchema(new DOMSource(result
			.getNode()));

	final Marshaller marshaller = context.createMarshaller();
	marshaller.setSchema(schema);
	// Works
	marshaller.marshal(new A("works"), System.out);
	// Fails
	marshaller.marshal(new A(null), System.out);
}
 
Example 2
Source File: WSDLGenerator.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private Result nonGlassfishSchemaResult(String namespaceUri, String suggestedFileName) throws IOException {
    DOMResult result = new DOMResult();
    result.setSystemId("");
    nonGlassfishSchemas.add(result);
    return result;
}
 
Example 3
Source File: WSDLGenerator.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private Result nonGlassfishSchemaResult(String namespaceUri, String suggestedFileName) throws IOException {
    DOMResult result = new DOMResult();
    result.setSystemId("");
    nonGlassfishSchemas.add(result);
    return result;
}
 
Example 4
Source File: WSDLGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private Result nonGlassfishSchemaResult(String namespaceUri, String suggestedFileName) throws IOException {
    DOMResult result = new DOMResult();
    result.setSystemId("");
    nonGlassfishSchemas.add(result);
    return result;
}
 
Example 5
Source File: WSDLGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private Result nonGlassfishSchemaResult(String namespaceUri, String suggestedFileName) throws IOException {
    DOMResult result = new DOMResult();
    result.setSystemId("");
    nonGlassfishSchemas.add(result);
    return result;
}
 
Example 6
Source File: WSDLGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private Result nonGlassfishSchemaResult(String namespaceUri, String suggestedFileName) throws IOException {
    DOMResult result = new DOMResult();
    result.setSystemId("");
    nonGlassfishSchemas.add(result);
    return result;
}
 
Example 7
Source File: WSDLGenerator.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private Result nonGlassfishSchemaResult(String namespaceUri, String suggestedFileName) throws IOException {
    DOMResult result = new DOMResult();
    result.setSystemId("");
    nonGlassfishSchemas.add(result);
    return result;
}
 
Example 8
Source File: WSDLGenerator.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private Result nonGlassfishSchemaResult(String namespaceUri, String suggestedFileName) throws IOException {
    DOMResult result = new DOMResult();
    result.setSystemId("");
    nonGlassfishSchemas.add(result);
    return result;
}
 
Example 9
Source File: WSDLGenerator.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private Result nonGlassfishSchemaResult(String namespaceUri, String suggestedFileName) throws IOException {
    DOMResult result = new DOMResult();
    result.setSystemId("");
    nonGlassfishSchemas.add(result);
    return result;
}