Java Code Examples for javax.xml.bind.SchemaOutputResolver#createOutput()
The following examples show how to use
javax.xml.bind.SchemaOutputResolver#createOutput() .
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: XmlSchemaGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Write out the schema documents. */ public void write(SchemaOutputResolver resolver, ErrorListener errorListener) throws IOException { if(resolver==null) throw new IllegalArgumentException(); if(logger.isLoggable(Level.FINE)) { // debug logging to see what's going on. logger.log(Level.FINE,"Writing XML Schema for "+toString(),new StackRecorder()); } // make it fool-proof resolver = new FoolProofResolver(resolver); this.errorListener = errorListener; Map<String, String> schemaLocations = types.getSchemaLocations(); Map<Namespace,Result> out = new HashMap<Namespace,Result>(); Map<Namespace,String> systemIds = new HashMap<Namespace,String>(); // we create a Namespace object for the XML Schema namespace // as a side-effect, but we don't want to generate it. namespaces.remove(WellKnownNamespace.XML_SCHEMA); // first create the outputs for all so that we can resolve references among // schema files when we write for( Namespace n : namespaces.values() ) { String schemaLocation = schemaLocations.get(n.uri); if(schemaLocation!=null) { systemIds.put(n,schemaLocation); } else { Result output = resolver.createOutput(n.uri,"schema"+(out.size()+1)+".xsd"); if(output!=null) { // null result means no schema for that namespace out.put(n,output); systemIds.put(n,output.getSystemId()); } } //Clear the namespace specific set with already written classes n.resetWritten(); } // then write'em all for( Map.Entry<Namespace,Result> e : out.entrySet() ) { Result result = e.getValue(); e.getKey().writeTo( result, systemIds ); if(result instanceof StreamResult) { OutputStream outputStream = ((StreamResult)result).getOutputStream(); if(outputStream != null) { outputStream.close(); // fix for bugid: 6291301 } else { final Writer writer = ((StreamResult)result).getWriter(); if(writer != null) writer.close(); } } } }
Example 2
Source File: XmlSchemaGenerator.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Write out the schema documents. */ public void write(SchemaOutputResolver resolver, ErrorListener errorListener) throws IOException { if(resolver==null) throw new IllegalArgumentException(); if(logger.isLoggable(Level.FINE)) { // debug logging to see what's going on. logger.log(Level.FINE,"Wrigin XML Schema for "+toString(),new StackRecorder()); } // make it fool-proof resolver = new FoolProofResolver(resolver); this.errorListener = errorListener; Map<String, String> schemaLocations = types.getSchemaLocations(); Map<Namespace,Result> out = new HashMap<Namespace,Result>(); Map<Namespace,String> systemIds = new HashMap<Namespace,String>(); // we create a Namespace object for the XML Schema namespace // as a side-effect, but we don't want to generate it. namespaces.remove(WellKnownNamespace.XML_SCHEMA); // first create the outputs for all so that we can resolve references among // schema files when we write for( Namespace n : namespaces.values() ) { String schemaLocation = schemaLocations.get(n.uri); if(schemaLocation!=null) { systemIds.put(n,schemaLocation); } else { Result output = resolver.createOutput(n.uri,"schema"+(out.size()+1)+".xsd"); if(output!=null) { // null result means no schema for that namespace out.put(n,output); systemIds.put(n,output.getSystemId()); } } } // then write'em all for( Map.Entry<Namespace,Result> e : out.entrySet() ) { Result result = e.getValue(); e.getKey().writeTo( result, systemIds ); if(result instanceof StreamResult) { OutputStream outputStream = ((StreamResult)result).getOutputStream(); if(outputStream != null) { outputStream.close(); // fix for bugid: 6291301 } else { final Writer writer = ((StreamResult)result).getWriter(); if(writer != null) writer.close(); } } } }
Example 3
Source File: XmlSchemaGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Write out the schema documents. */ public void write(SchemaOutputResolver resolver, ErrorListener errorListener) throws IOException { if(resolver==null) throw new IllegalArgumentException(); if(logger.isLoggable(Level.FINE)) { // debug logging to see what's going on. logger.log(Level.FINE,"Writing XML Schema for "+toString(),new StackRecorder()); } // make it fool-proof resolver = new FoolProofResolver(resolver); this.errorListener = errorListener; Map<String, String> schemaLocations = types.getSchemaLocations(); Map<Namespace,Result> out = new HashMap<Namespace,Result>(); Map<Namespace,String> systemIds = new HashMap<Namespace,String>(); // we create a Namespace object for the XML Schema namespace // as a side-effect, but we don't want to generate it. namespaces.remove(WellKnownNamespace.XML_SCHEMA); // first create the outputs for all so that we can resolve references among // schema files when we write for( Namespace n : namespaces.values() ) { String schemaLocation = schemaLocations.get(n.uri); if(schemaLocation!=null) { systemIds.put(n,schemaLocation); } else { Result output = resolver.createOutput(n.uri,"schema"+(out.size()+1)+".xsd"); if(output!=null) { // null result means no schema for that namespace out.put(n,output); systemIds.put(n,output.getSystemId()); } } //Clear the namespace specific set with already written classes n.resetWritten(); } // then write'em all for( Map.Entry<Namespace,Result> e : out.entrySet() ) { Result result = e.getValue(); e.getKey().writeTo( result, systemIds ); if(result instanceof StreamResult) { OutputStream outputStream = ((StreamResult)result).getOutputStream(); if(outputStream != null) { outputStream.close(); // fix for bugid: 6291301 } else { final Writer writer = ((StreamResult)result).getWriter(); if(writer != null) writer.close(); } } } }
Example 4
Source File: XmlSchemaGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Write out the schema documents. */ public void write(SchemaOutputResolver resolver, ErrorListener errorListener) throws IOException { if(resolver==null) throw new IllegalArgumentException(); if(logger.isLoggable(Level.FINE)) { // debug logging to see what's going on. logger.log(Level.FINE,"Writing XML Schema for "+toString(),new StackRecorder()); } // make it fool-proof resolver = new FoolProofResolver(resolver); this.errorListener = errorListener; Map<String, String> schemaLocations = types.getSchemaLocations(); Map<Namespace,Result> out = new HashMap<Namespace,Result>(); Map<Namespace,String> systemIds = new HashMap<Namespace,String>(); // we create a Namespace object for the XML Schema namespace // as a side-effect, but we don't want to generate it. namespaces.remove(WellKnownNamespace.XML_SCHEMA); // first create the outputs for all so that we can resolve references among // schema files when we write for( Namespace n : namespaces.values() ) { String schemaLocation = schemaLocations.get(n.uri); if(schemaLocation!=null) { systemIds.put(n,schemaLocation); } else { Result output = resolver.createOutput(n.uri,"schema"+(out.size()+1)+".xsd"); if(output!=null) { // null result means no schema for that namespace out.put(n,output); systemIds.put(n,output.getSystemId()); } } //Clear the namespace specific set with already written classes n.resetWritten(); } // then write'em all for( Map.Entry<Namespace,Result> e : out.entrySet() ) { Result result = e.getValue(); e.getKey().writeTo( result, systemIds ); if(result instanceof StreamResult) { OutputStream outputStream = ((StreamResult)result).getOutputStream(); if(outputStream != null) { outputStream.close(); // fix for bugid: 6291301 } else { final Writer writer = ((StreamResult)result).getWriter(); if(writer != null) writer.close(); } } } }
Example 5
Source File: XmlSchemaGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Write out the schema documents. */ public void write(SchemaOutputResolver resolver, ErrorListener errorListener) throws IOException { if(resolver==null) throw new IllegalArgumentException(); if(logger.isLoggable(Level.FINE)) { // debug logging to see what's going on. logger.log(Level.FINE,"Writing XML Schema for "+toString(),new StackRecorder()); } // make it fool-proof resolver = new FoolProofResolver(resolver); this.errorListener = errorListener; Map<String, String> schemaLocations = types.getSchemaLocations(); Map<Namespace,Result> out = new HashMap<Namespace,Result>(); Map<Namespace,String> systemIds = new HashMap<Namespace,String>(); // we create a Namespace object for the XML Schema namespace // as a side-effect, but we don't want to generate it. namespaces.remove(WellKnownNamespace.XML_SCHEMA); // first create the outputs for all so that we can resolve references among // schema files when we write for( Namespace n : namespaces.values() ) { String schemaLocation = schemaLocations.get(n.uri); if(schemaLocation!=null) { systemIds.put(n,schemaLocation); } else { Result output = resolver.createOutput(n.uri,"schema"+(out.size()+1)+".xsd"); if(output!=null) { // null result means no schema for that namespace out.put(n,output); systemIds.put(n,output.getSystemId()); } } //Clear the namespace specific set with already written classes n.resetWritten(); } // then write'em all for( Map.Entry<Namespace,Result> e : out.entrySet() ) { Result result = e.getValue(); e.getKey().writeTo( result, systemIds ); if(result instanceof StreamResult) { OutputStream outputStream = ((StreamResult)result).getOutputStream(); if(outputStream != null) { outputStream.close(); // fix for bugid: 6291301 } else { final Writer writer = ((StreamResult)result).getWriter(); if(writer != null) writer.close(); } } } }
Example 6
Source File: XmlSchemaGenerator.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Write out the schema documents. */ public void write(SchemaOutputResolver resolver, ErrorListener errorListener) throws IOException { if(resolver==null) throw new IllegalArgumentException(); if(logger.isLoggable(Level.FINE)) { // debug logging to see what's going on. logger.log(Level.FINE,"Writing XML Schema for "+toString(),new StackRecorder()); } // make it fool-proof resolver = new FoolProofResolver(resolver); this.errorListener = errorListener; Map<String, String> schemaLocations = types.getSchemaLocations(); Map<Namespace,Result> out = new HashMap<Namespace,Result>(); Map<Namespace,String> systemIds = new HashMap<Namespace,String>(); // we create a Namespace object for the XML Schema namespace // as a side-effect, but we don't want to generate it. namespaces.remove(WellKnownNamespace.XML_SCHEMA); // first create the outputs for all so that we can resolve references among // schema files when we write for( Namespace n : namespaces.values() ) { String schemaLocation = schemaLocations.get(n.uri); if(schemaLocation!=null) { systemIds.put(n,schemaLocation); } else { Result output = resolver.createOutput(n.uri,"schema"+(out.size()+1)+".xsd"); if(output!=null) { // null result means no schema for that namespace out.put(n,output); systemIds.put(n,output.getSystemId()); } } //Clear the namespace specific set with already written classes n.resetWritten(); } // then write'em all for( Map.Entry<Namespace,Result> e : out.entrySet() ) { Result result = e.getValue(); e.getKey().writeTo( result, systemIds ); if(result instanceof StreamResult) { OutputStream outputStream = ((StreamResult)result).getOutputStream(); if(outputStream != null) { outputStream.close(); // fix for bugid: 6291301 } else { final Writer writer = ((StreamResult)result).getWriter(); if(writer != null) writer.close(); } } } }
Example 7
Source File: XmlSchemaGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Write out the schema documents. */ public void write(SchemaOutputResolver resolver, ErrorListener errorListener) throws IOException { if(resolver==null) throw new IllegalArgumentException(); if(logger.isLoggable(Level.FINE)) { // debug logging to see what's going on. logger.log(Level.FINE,"Wrigin XML Schema for "+toString(),new StackRecorder()); } // make it fool-proof resolver = new FoolProofResolver(resolver); this.errorListener = errorListener; Map<String, String> schemaLocations = types.getSchemaLocations(); Map<Namespace,Result> out = new HashMap<Namespace,Result>(); Map<Namespace,String> systemIds = new HashMap<Namespace,String>(); // we create a Namespace object for the XML Schema namespace // as a side-effect, but we don't want to generate it. namespaces.remove(WellKnownNamespace.XML_SCHEMA); // first create the outputs for all so that we can resolve references among // schema files when we write for( Namespace n : namespaces.values() ) { String schemaLocation = schemaLocations.get(n.uri); if(schemaLocation!=null) { systemIds.put(n,schemaLocation); } else { Result output = resolver.createOutput(n.uri,"schema"+(out.size()+1)+".xsd"); if(output!=null) { // null result means no schema for that namespace out.put(n,output); systemIds.put(n,output.getSystemId()); } } } // then write'em all for( Map.Entry<Namespace,Result> e : out.entrySet() ) { Result result = e.getValue(); e.getKey().writeTo( result, systemIds ); if(result instanceof StreamResult) { OutputStream outputStream = ((StreamResult)result).getOutputStream(); if(outputStream != null) { outputStream.close(); // fix for bugid: 6291301 } else { final Writer writer = ((StreamResult)result).getWriter(); if(writer != null) writer.close(); } } } }
Example 8
Source File: XmlSchemaGenerator.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Write out the schema documents. */ public void write(SchemaOutputResolver resolver, ErrorListener errorListener) throws IOException { if(resolver==null) throw new IllegalArgumentException(); if(logger.isLoggable(Level.FINE)) { // debug logging to see what's going on. logger.log(Level.FINE,"Wrigin XML Schema for "+toString(),new StackRecorder()); } // make it fool-proof resolver = new FoolProofResolver(resolver); this.errorListener = errorListener; Map<String, String> schemaLocations = types.getSchemaLocations(); Map<Namespace,Result> out = new HashMap<Namespace,Result>(); Map<Namespace,String> systemIds = new HashMap<Namespace,String>(); // we create a Namespace object for the XML Schema namespace // as a side-effect, but we don't want to generate it. namespaces.remove(WellKnownNamespace.XML_SCHEMA); // first create the outputs for all so that we can resolve references among // schema files when we write for( Namespace n : namespaces.values() ) { String schemaLocation = schemaLocations.get(n.uri); if(schemaLocation!=null) { systemIds.put(n,schemaLocation); } else { Result output = resolver.createOutput(n.uri,"schema"+(out.size()+1)+".xsd"); if(output!=null) { // null result means no schema for that namespace out.put(n,output); systemIds.put(n,output.getSystemId()); } } } // then write'em all for( Map.Entry<Namespace,Result> e : out.entrySet() ) { Result result = e.getValue(); e.getKey().writeTo( result, systemIds ); if(result instanceof StreamResult) { OutputStream outputStream = ((StreamResult)result).getOutputStream(); if(outputStream != null) { outputStream.close(); // fix for bugid: 6291301 } else { final Writer writer = ((StreamResult)result).getWriter(); if(writer != null) writer.close(); } } } }