/** * Indicates if a Result has been set for this Schema. * * @return true if a Result has been set, false otherwise */ public boolean hasResult() { return getResult() != null; }
/** * Indicates if a Result has been set for this Schema. * * @return true if a Result has been set, false otherwise */ public boolean hasResult() { return getResult() != null; }
/** * Get the SystemId for this Schema. This value will typically be * used as the schemaLocation in an import statement. * * @return the systemID set on this Schema's Result object if both * the Result and the Result's systemID are non-null, * otherwise null */ public String getSystemId() { if (hasResult()) { return getResult().getSystemId(); } return null; } }
/** * Get the SystemId for this Schema. This value will typically be * used as the schemaLocation in an import statement. * * @return the systemID set on this Schema's Result object if both * the Result and the Result's systemID are non-null, * otherwise null */ public String getSystemId() { if (hasResult()) { return getResult().getSystemId(); } return null; } }
public Map<String, SchemaTypeInfo> generateSchemaFiles(SchemaOutputResolver outputResolver, Map<QName, Type> additionalGlobalElements) { // process any additional global elements processAdditionalElements(additionalGlobalElements, annotationsProcessor); schemaGenerator.generateSchema(annotationsProcessor.getTypeInfoClasses(), annotationsProcessor.getTypeInfos(), annotationsProcessor.getUserDefinedSchemaTypes(), annotationsProcessor.getPackageToPackageInfoMappings(), annotationsProcessor.getGlobalElements(), annotationsProcessor.getArrayClassesToGeneratedClasses(), outputResolver); CoreProject proj = new SchemaModelProject(); XMLContext context = new XMLContext((Project)proj); XMLMarshaller marshaller = context.createMarshaller(); Descriptor schemaDescriptor = (Descriptor)proj.getDescriptor(Schema.class); java.util.Collection<Schema> schemas = schemaGenerator.getAllSchemas(); for(Schema schema : schemas) { try { NamespaceResolver schemaNamespaces = schema.getNamespaceResolver(); schemaNamespaces.put(Constants.SCHEMA_PREFIX, XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaDescriptor.setNamespaceResolver(schemaNamespaces); // make sure we don't call into the provided output resolver more than once javax.xml.transform.Result target; if (schema.hasResult()) { target = schema.getResult(); } else { target = outputResolver.createOutput(schema.getTargetNamespace(), schema.getName()); } marshaller.marshal(schema, target); } catch (IOException ex) { ex.printStackTrace(); } } return schemaGenerator.getSchemaTypeInfo(); }
public Map<String, SchemaTypeInfo> generateSchemaFiles(SchemaOutputResolver outputResolver, Map<QName, Type> additionalGlobalElements) { // process any additional global elements processAdditionalElements(additionalGlobalElements, annotationsProcessor); schemaGenerator.generateSchema(annotationsProcessor.getTypeInfoClasses(), annotationsProcessor.getTypeInfos(), annotationsProcessor.getUserDefinedSchemaTypes(), annotationsProcessor.getPackageToPackageInfoMappings(), annotationsProcessor.getGlobalElements(), annotationsProcessor.getArrayClassesToGeneratedClasses(), outputResolver); CoreProject proj = new SchemaModelProject(); XMLContext context = new XMLContext((Project)proj); XMLMarshaller marshaller = context.createMarshaller(); Descriptor schemaDescriptor = (Descriptor)proj.getDescriptor(Schema.class); java.util.Collection<Schema> schemas = schemaGenerator.getAllSchemas(); for(Schema schema : schemas) { try { NamespaceResolver schemaNamespaces = schema.getNamespaceResolver(); schemaNamespaces.put(Constants.SCHEMA_PREFIX, XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaDescriptor.setNamespaceResolver(schemaNamespaces); // make sure we don't call into the provided output resolver more than once javax.xml.transform.Result target; if (schema.hasResult()) { target = schema.getResult(); } else { target = outputResolver.createOutput(schema.getTargetNamespace(), schema.getName()); } marshaller.marshal(schema, target); } catch (IOException ex) { ex.printStackTrace(); } } return schemaGenerator.getSchemaTypeInfo(); }