本文整理汇总了Java中com.sun.xml.internal.bind.v2.util.StackRecorder类的典型用法代码示例。如果您正苦于以下问题:Java StackRecorder类的具体用法?Java StackRecorder怎么用?Java StackRecorder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StackRecorder类属于com.sun.xml.internal.bind.v2.util包,在下文中一共展示了StackRecorder类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import com.sun.xml.internal.bind.v2.util.StackRecorder; //导入依赖的package包/类
/**
* 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();
}
}
}
}
示例2: write
import com.sun.xml.internal.bind.v2.util.StackRecorder; //导入依赖的package包/类
/**
* 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();
}
}
}
}