Java源码示例:com.sun.xml.internal.bind.api.ErrorListener

示例1
/**
 * 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();
            }
        }
    }
}
 
示例2
/**
 * 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();
            }
        }
    }
}
 
示例3
/**
 * 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();
            }
        }
    }
}
 
示例4
/**
 * 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();
            }
        }
    }
}
 
示例5
/**
 * 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();
            }
        }
    }
}
 
示例6
/**
 * 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();
            }
        }
    }
}
 
示例7
/**
 * 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();
            }
        }
    }
}
 
示例8
/**
 * 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();
            }
        }
    }
}