本文整理汇总了Java中org.eclipse.xsd.XSDImport类的典型用法代码示例。如果您正苦于以下问题:Java XSDImport类的具体用法?Java XSDImport怎么用?Java XSDImport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSDImport类属于org.eclipse.xsd包,在下文中一共展示了XSDImport类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: importGMLSchema
import org.eclipse.xsd.XSDImport; //导入依赖的package包/类
@Override
protected void importGMLSchema(XSDSchema schema, XSDFactory factory, String baseUrl) {
synchronized(Schemas.class) {
XSDImport imprt;
try {
imprt = factory.createXSDImport();
imprt.setNamespace(gmlNamespace);
//imprt.setNamespace( WFS.getInstance().getSchema().getTargetNamespace() );
imprt.setSchemaLocation(ResponseUtils.buildSchemaURL(baseUrl, gmlSchemaLocation));
//imprt.setResolvedSchema(WFS.getInstance().getSchema());
imprt.setResolvedSchema( GML.getInstance().getSchema() );
schema.getContents().add( imprt );
schema.getQNamePrefixToNamespaceMap().put("wfs", WFS.NAMESPACE);
//imprt = Schemas.importSchema(schema, WFS.getInstance().getSchema());
((XSDSchemaImpl)WFS.getInstance().getSchema()).imported(imprt);
//((XSDSchemaImpl)schema).resolveSchema(WFS.NAMESPACE);
//schema.getContents().add(imprt);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
示例2: findLocation
import org.eclipse.xsd.XSDImport; //导入依赖的package包/类
private String findLocation(final String theNamespace) {
if (theSchema.getTargetNamespace().equals(theNamespace)) {
return encode(relativize(xmlURI.trimSegments(1), theSchema.eResource().getURI()));
}
for (final XSDImport i : EcoreUtil.<XSDImport> getObjectsByType(theSchema.getContents(),
XSDPackage.Literals.XSD_IMPORT)) {
if (i.getNamespace().equals(theNamespace)) {
return "../" + encode(i.getSchemaLocation().replaceFirst("^\\./", ""));
}
}
return null;
}
示例3: addReference
import org.eclipse.xsd.XSDImport; //导入依赖的package包/类
/**
* Add a schema reference using include or import. Duplicate conflicting imports are not allowed
* (warning is logged).
*
* @param schema
* schema to which the reference is being added
* @param factory
* used to make stuff
* @param namespace
* namespace URI of the referenced schema
* @param schemaLocation
* location URI of the referenced schema
* @param imports
* map of namespace to schemaLocation used to prevent duplicate imports
* @param includes
* set of schemaLocations used to prevent duplicate includes
*/
private void addReference(XSDSchema schema, XSDFactory factory, String namespace,
String schemaLocation, Map<String, String> imports, Set<String> includes) {
if (getWfsSchema() != null && imports.get(getWfsSchema().getTargetNamespace()) == null) {
synchronized(Schemas.class) {
/*
* Add an import for the WFS schema. Needed for GML32OutputFormat only. See
* GML32.importGMLSchema where a similar import is used for simple features (generated
* schema).
*
* Not that this does not break DescribeFeatureType because it uses WFS 1.1.
*/
schema.getQNamePrefixToNamespaceMap().put("wfs", getWfsSchema().getTargetNamespace());
XSDImport wfsImport = factory.createXSDImport();
wfsImport.setNamespace(getWfsSchema().getTargetNamespace());
wfsImport.setSchemaLocation(getWfsSchema().getSchemaLocation());
wfsImport.setResolvedSchema(getWfsSchema());
schema.getContents().add(wfsImport);
((XSDSchemaImpl)getWfsSchema()).imported(wfsImport);
imports.put(getWfsSchema().getTargetNamespace(), getWfsSchema().getSchemaLocation());
}
}
if (namespace.equals(schema.getTargetNamespace())) {
if (includes.contains(schemaLocation)) {
logger.finer("Skipped generation of duplicate include for schemaLocation=\""
+ schemaLocation + " while generating schema for "
+ schema.getTargetNamespace());
} else {
addInclude(schema, factory, schemaLocation);
includes.add(schemaLocation);
}
} else {
if (imports.get(namespace) != null) {
if (imports.get(namespace).equals(schemaLocation)) {
logger.finer("Skipped generation of duplicate import for namespace=\""
+ namespace + "\" schemaLocation=\"" + schemaLocation
+ " while generating schema for " + schema.getTargetNamespace());
} else {
logger.warning("Skipped generation of conflicting import for namespace=\""
+ namespace
+ "\" schemaLocation=\""
+ schemaLocation
+ " while generating schema for "
+ schema.getTargetNamespace()
+ " (some XML processors will ignore all imports for a namespace after the first)");
}
} else {
addImport(schema, factory, namespace, schemaLocation);
imports.put(namespace, schemaLocation);
}
}
}
示例4: importSchema
import org.eclipse.xsd.XSDImport; //导入依赖的package包/类
@Operation(contextual = true, kind = Operation.Kind.HELPER)
public static void importSchema(final XSDImport self) {
throw new UnsupportedOperationException("Not yet implemented");
}
示例5: addImport
import org.eclipse.xsd.XSDImport; //导入依赖的package包/类
/**
* Add import statement to schema.
*
* @param schema
* Output schema
* @param factory
* XSD factory used to produce schema
* @param namespace
* Import name space
* @param schemaLocation
* The schema to be imported
*/
private void addImport(XSDSchema schema, XSDFactory factory, String namespace,
String schemaLocation) {
synchronized(Schemas.class) {
XSDImport xsdImport = factory.createXSDImport();
xsdImport.setNamespace(namespace);
xsdImport.setSchemaLocation(schemaLocation);
schema.getContents().add(xsdImport);
}
}