本文整理汇总了Java中org.eclipse.xsd.XSDSchema类的典型用法代码示例。如果您正苦于以下问题:Java XSDSchema类的具体用法?Java XSDSchema怎么用?Java XSDSchema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSDSchema类属于org.eclipse.xsd包,在下文中一共展示了XSDSchema类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildSchemaContent
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
private void buildSchemaContent(FeatureTypeInfo featureTypeMeta, XSDSchema schema,
XSDFactory factory, String baseUrl)
throws IOException {
if (!findTypeInSchema(featureTypeMeta, schema, factory)) {
// build the type manually
FeatureType featureType = featureTypeMeta.getFeatureType();
if(featureTypeMeta.isCircularArcPresent() && this.getClass().equals(GML3.class)) {
featureType = new CurveTypeWrapper(featureType);
}
XSDComplexTypeDefinition xsdComplexType = buildComplexSchemaContent(featureType, schema, factory);
XSDElementDeclaration element = factory.createXSDElementDeclaration();
element.setName(featureTypeMeta.getName());
element.setTargetNamespace(featureTypeMeta.getNamespace().getURI());
synchronized(Schemas.class) {
// this call changes the global schemas too, need to be synchronized
element.setSubstitutionGroupAffiliation(getFeatureElement());
}
element.setTypeDefinition(xsdComplexType);
schema.getContents().add(element);
schema.updateElement();
}
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:26,代码来源:ISOFeatureTypeSchemaBuilder.java
示例2: importGMLSchema
import org.eclipse.xsd.XSDSchema; //导入依赖的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);
}
}
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:27,代码来源:ISOFeatureTypeSchemaBuilder.java
示例3: setTypeName
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
@Operation(contextual=true)
static public void setTypeName(Part wsdlElement,XSDTypeDefinition xsdType,Definition definition) {
if(xsdType==null){
LOG.error("Invalid xsd type for part "+wsdlElement+", definition="+definition);
return;
}
String namespace=xsdType.getTargetNamespace();
String localName=xsdType.getName();
// is prefix there?
XSDSchema schema=xsdType.getSchema();
if((namespace==null)&&(schema!=null)){
namespace=schema.getTargetNamespace();
}
String prefix=getSchemaPrefix(schema);
QName qname=new QName(namespace, localName,prefix);
definition.addNamespace(prefix, namespace);
wsdlElement.setTypeName(qname);
if((namespace==null)||(prefix==null)){
LOG.error("Invalid namespace "+namespace+", prefix="+prefix+", schema="+schema+", type="+xsdType);
}
}
开发者ID:GRA-UML,项目名称:tool,代码行数:23,代码来源:GraQvtLibrary.java
示例4: findSchemaFor
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
private XSDSchema findSchemaFor(final FileType file) {
final Iterable<XSDSchema> targetSchemas = getTargetSchemas();
final String[] pathSegments = file.getRelativePathName().replaceFirst("^\\./", "").split("/");
NEXT_SCHEMA: for (final XSDSchema nextSchema : targetSchemas) {
final URI nextSchemaURI = nextSchema.eResource().getURI();
final int segmentCount = nextSchemaURI.segmentCount();
if (pathSegments.length > segmentCount) {
continue NEXT_SCHEMA;
}
for (int i = 0; i < pathSegments.length; i++) {
if (!pathSegments[pathSegments.length - 1 - i].equals(nextSchemaURI.segment(segmentCount - 1 - i))) {
continue NEXT_SCHEMA;
}
}
return nextSchema;
}
LOG.error("Failed to find schema for "+file.getRelativePathName()+" in "+targetSchemas);
return null;
}
开发者ID:GRA-UML,项目名称:tool,代码行数:20,代码来源:NIEMmpdmodel2artifactDelegate.java
示例5: generateTheXmlSamples
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
private Iterable<Resource> generateTheXmlSamples(final URI theSamplesDirectory) {
toFile(theSamplesDirectory).mkdirs();
final Collection<Resource> theXmlSamples = new ArrayList<>();
for (final XSDSchema xsdSchema : getTheExchangeSchemas()) {
for (final XSDElementDeclaration xsdElementDeclaration : xsdSchema.getElementDeclarations()) {
final String elementName = xsdElementDeclaration.getName();
if (xsdElementDeclaration.getSchema() == xsdSchema && elementName != null) {
SafeRunner.run(new ISafeRunnable() {
@Override
public void run() throws Exception {
final Resource anXmlSample = new NewXMLGeneratorExtension(xsdSchema, theSamplesDirectory
.appendSegment(elementName + getSampleXmlSuffix()).appendFileExtension("xml"),
elementName).generateSample();
theXmlSamples.add(anXmlSample);
}
@Override
public void handleException(final Throwable e) {
Activator.INSTANCE.log(e);
}
});
}
}
}
return theXmlSamples;
}
开发者ID:GRA-UML,项目名称:tool,代码行数:27,代码来源:NIEMmpdmodel2artifactDelegate.java
示例6: persist
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
@Override
protected void persist() throws IOException {
// make sure eclipse workspace uptodate
for(IProject project:ResourcesPlugin.getWorkspace().getRoot().getProjects()){
try {
project.refreshLocal(IProject.DEPTH_INFINITE, null);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
final HashMap<Object, Object> saveOptions = new HashMap<>(resourceSet.getLoadOptions());
for (final Resource infrastructureResource : infrastructureResources) {
infrastructureResource.save(saveOptions);
}
for (final XSDSchema schema : getTargetSchemas()) {
final Resource xsd = resourceSet.createResource(appendPath(targetFolder, schema.getSchemaLocation()));
xsd.getContents().add(schema);
LOG.info("Persist to "+xsd.getURI());
xsd.save(saveOptions);
}
}
开发者ID:GRA-UML,项目名称:tool,代码行数:24,代码来源:NIEMpsm2xsdDelegate.java
示例7: relativeMdpLocation
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
@Operation(contextual = true, kind = Operation.Kind.QUERY)
public static String relativeMdpLocation(final XSDSchema self) {
final URI theSchemaURI = self.eResource().getURI();
final File theSchemaFile;
if (theSchemaURI.isPlatformResource()) {
final String platformRelativePath = theSchemaURI.toPlatformString(true);
theSchemaFile = ResourcesPlugin.getWorkspace().getRoot()
.findMember(Path.fromPortableString(platformRelativePath)).getLocation().toFile();
} else {
theSchemaFile = new File(theSchemaURI.toFileString());
}
File theParentDirectory = theSchemaFile.getParentFile();
while (theParentDirectory != null) {
if (containsACatalog(theParentDirectory)) {
break;
}
theParentDirectory = theParentDirectory.getParentFile();
}
final String theRelativePath = theParentDirectory.toPath().relativize(theSchemaFile.toPath()).toString();
return theRelativePath;
}
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:22,代码来源:NiemQvtLibrary.java
示例8: findSchemaFor
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
private XSDSchema findSchemaFor(final FileType file) {
final Iterable<XSDSchema> targetSchemas = getTargetSchemas();
final String[] pathSegments = file.getRelativePathName().replaceFirst("^\\./", "").split("/");
NEXT_SCHEMA: for (final XSDSchema nextSchema : targetSchemas) {
final URI nextSchemaURI = nextSchema.eResource().getURI();
final int segmentCount = nextSchemaURI.segmentCount();
if (pathSegments.length > segmentCount) {
continue NEXT_SCHEMA;
}
for (int i = 0; i < pathSegments.length; i++) {
if (!pathSegments[pathSegments.length - 1 - i].equals(nextSchemaURI.segment(segmentCount - 1 - i))) {
continue NEXT_SCHEMA;
}
}
return nextSchema;
}
return null;
}
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:19,代码来源:NIEMmpdmodel2artifactDelegate.java
示例9: testDeserializeXSD
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
@Test
public void testDeserializeXSD() {
URI uri = URI.createFileURI(LINK_STAT_XSD);
String xsdStr = null;
try {
xsdStr = TestUtil.readFileAsString(uri.toFileString());
} catch (IOException e) {
Throwables.propagate(e);
}
XSDSchema xsd = xmlModelRepository.loadXSD(uri, xsdStr);
assertNotNull(xsd);
XSDEcoreBuilder xsdEcoreBuilder = new XSDEcoreBuilder();
xsdEcoreBuilder.generate(xsd);
Collection<EPackage> metaModel = xsdEcoreBuilder.getTargetNamespaceToEPackageMap().values();
assertEquals(1, metaModel.size());
}
开发者ID:markus1978,项目名称:clickwatch,代码行数:20,代码来源:XmlModelRepositoryTest.java
示例10: userChooseStructure
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
public static XSDStructure userChooseStructure(IWorkbenchPart targetPart) throws MapperException
{
XSDStructure xsd = null;
// show a dialog for the user to choose a schema, if he wants to order the EReferences correctly
String[] exts = {"*.xsd"};
String schemaFilePath = FileUtil.getFilePathFromUser(targetPart,exts,"Select XML schema",false);
if (schemaFilePath.equals("")) return xsd;
// Open the schema
URI uri = FileUtil.URIFromPath(schemaFilePath);
XSDSchema theSchema = XSDStructure.getXSDRoot(uri);
// find the tree StructureDefinition from the schema
if (theSchema != null) xsd = new XSDStructure(theSchema);
return xsd;
}
开发者ID:openmapsoftware,项目名称:mappingtools,代码行数:18,代码来源:FileUtil.java
示例11: getMappedStructureName
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
/**
* @param ed an Element declaration or Attribute declaration
* @return the element or attribute name, with a namespace prefix as defined from the whole schema
* set by XSDStructure.makeNamespaceSet.
* This method is used in stead of getQName() because getQName seems to return a prefix as in
* the schema holding the declaration, whereas the single prefix I have allocated
* may be different. This ensures just one prefix for every namespace, and
* resolves prefix clashes between different schema documents.
* @throws MapperException if the namespace uri is not recognised as having a prefix
*/
private String getMappedStructureName(XSDFeature ed) throws MapperException
{
String name = ed.getName();
String namespaceURI = ed.getTargetNamespace();
/* The element name in instances will have a namespace prefix if the Element is in a
* target namespace, and either the scope of the declaration is schema-wide
* or the element form is qualified. */
if ((namespaceURI != null) &&
((ed.getScope() instanceof XSDSchema)|(ed.getForm() == XSDForm.QUALIFIED_LITERAL)))
{
namespace ns = NSSet.getByURI(namespaceURI);
if (ns == null)throw new MapperException("Cannot find namespace with URI '"
+ namespaceURI + "'");
if (!(ns.prefix().equals(""))) name = ns.prefix() + ":" + name;
}
return name;
}
开发者ID:openmapsoftware,项目名称:mappingtools,代码行数:28,代码来源:XSDStructure.java
示例12: getXSDRoot
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
/**
* Open a file as a XSD model
* @param uri the URI of the XSD model file
* @return the XSDSchema (EObject subclass) root of the model; or null if failed to open
*/
public static XSDSchema getXSDRoot(URI uri)
{
XSDSchema theSchema = null;
ResourceSet resourceSet = new ResourceSetImpl();
// load the main schema file into the resourceSet.
//XSDResourceImpl xsdRes =
resourceSet.getResource(uri, true);
// getResources() returns an iterator over all the resources, therefore, the main resource
// and those that have been included, imported, or redefined.
for (Iterator<Resource> resources = resourceSet.getResources().iterator();
resources.hasNext(); /* no-op */)
{
// Return the first schema object found, which is the main schema
// loaded from the provided schemaURL
Resource resource = resources.next();
if ((resource instanceof XSDResourceImpl) && (theSchema == null))
{
XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
theSchema = xsdResource.getSchema();
}
}
return theSchema;
}
开发者ID:openmapsoftware,项目名称:mappingtools,代码行数:30,代码来源:XSDStructure.java
示例13: build
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
public XSDSchema build(FeatureTypeInfo[] featureTypeInfos, String baseUrl,
boolean resolveAppSchemaImports, boolean scheduleSchemaCleanup) throws IOException {
// build the schema and make sure to schedule it for destruction at the end of the request
XSDSchema schema = buildSchemaInternal(featureTypeInfos, baseUrl, resolveAppSchemaImports);
if(schema != null && scheduleSchemaCleanup) {
SchemaCleanerCallback.addSchema(schema);
}
return schema;
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:10,代码来源:ISOFeatureTypeSchemaBuilder.java
示例14: addApplicationTypes
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
/**
* Adds types defined in the catalog to the provided schema.
*/
public XSDSchema addApplicationTypes( XSDSchema wfsSchema ) throws IOException {
//incorporate application schemas into the wfs schema
Collection<FeatureTypeInfo> featureTypeInfos = catalog.getFeatureTypes();
for (Iterator<FeatureTypeInfo> i = featureTypeInfos.iterator(); i.hasNext();) {
FeatureTypeInfo meta = i.next();
// don't build schemas for disabled feature types
if(!meta.enabled())
continue;
//build the schema for the types in the single namespace (and don't clean them, they are not dynamic)
XSDSchema schema = buildSchemaInternal(new FeatureTypeInfo[] { meta }, null, false);
//declare the namespace
String prefix = meta.getNamespace().getPrefix();
String namespaceURI = meta.getNamespace().getURI();
wfsSchema.getQNamePrefixToNamespaceMap().put(prefix, namespaceURI);
//add the types + elements to the wfs schema
for (Iterator<XSDTypeDefinition> t = schema.getTypeDefinitions().iterator(); t.hasNext();) {
wfsSchema.getTypeDefinitions().add(t.next());
}
for (Iterator<XSDElementDeclaration> e = schema.getElementDeclarations().iterator(); e.hasNext();) {
wfsSchema.getElementDeclarations().add(e.next());
}
// add secondary namespaces from catalog
for (Map.Entry<String, String> entry : schema.getQNamePrefixToNamespaceMap()
.entrySet()) {
if (!wfsSchema.getQNamePrefixToNamespaceMap().containsKey(entry.getKey())) {
wfsSchema.getQNamePrefixToNamespaceMap().put(entry.getKey(), entry.getValue());
}
}
}
return wfsSchema;
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:43,代码来源:ISOFeatureTypeSchemaBuilder.java
示例15: resolveTypeInSchema
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
XSDTypeDefinition resolveTypeInSchema(XSDSchema schema, Name typeName) {
XSDTypeDefinition type = null;
for (XSDTypeDefinition td : (schema.getTypeDefinitions())) {
if (typeName.getNamespaceURI().equals(td.getTargetNamespace())
&& typeName.getLocalPart().equals(td.getName())) {
type = td;
break;
}
}
if (type == null) {
type = schema.resolveTypeDefinition(typeName.getNamespaceURI(),
typeName.getLocalPart());
}
return type;
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:16,代码来源:ISOFeatureTypeSchemaBuilder.java
示例16: gmlSchema
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
protected XSDSchema gmlSchema() {
if (gml2Schema == null) {
gml2Schema = xmlConfiguration.schema();
}
return gml2Schema;
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:8,代码来源:ISOFeatureTypeSchemaBuilder.java
示例17: createGml32Schema
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
XSDSchema createGml32Schema() {
try {
return GML.getInstance().getSchema();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:8,代码来源:ISOFeatureTypeSchemaBuilder.java
示例18: getWfsSchema
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
/**
* GML 3.2 responses require the WFS 2.0 schema to define WFS 2.0 FeatureCollection, which
* is used as the root element.
*
* @see org.geoserver.wfs.xml.ISOFeatureTypeSchemaBuilder#getWfsSchema()
*/
@Override
protected XSDSchema getWfsSchema() {
try {
return WFS.getInstance().getSchema();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:15,代码来源:ISOFeatureTypeSchemaBuilder.java
示例19: doWrite
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
protected void doWrite(FeatureTypeInfo[] featureTypeInfos, OutputStream output,
Operation describeFeatureType) throws IOException {
//create the schema
Object request = describeFeatureType.getParameters()[0];
DescribeFeatureTypeRequest req = DescribeFeatureTypeRequest.adapt(request);
XSDSchema schema = schemaBuilder.build(featureTypeInfos, req.getBaseURL());
//serialize
schema.updateElement();
final String encoding = gs.getSettings().getCharset();
XSDResourceImpl.serialize(output, schema.getElement(), encoding);
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:15,代码来源:XmlSchemaEncoder_ISO.java
示例20: getXSDSchemaFromNamespace
import org.eclipse.xsd.XSDSchema; //导入依赖的package包/类
@Override
public XSDSchema getXSDSchemaFromNamespace(String namespace) {
if (namespace == null) {
return null;
}
if (loadFromWSDL) {
if (resourceSet.getResources().size() > 0) {
// TESB-19040:process schema from import wsdl files
for (Resource resource : resourceSet.getResources()) {
if (resource.getContents().size() == 1) {
Object oDef = resource.getContents().get(0);
if (oDef instanceof Definition) {
Definition definition = (Definition) oDef;
for (Object o : definition.getETypes().getEExtensibilityElements()) {
XSDSchemaExtensibilityElement schema = (XSDSchemaExtensibilityElement) o;
if ((schema.getSchema() != null) && (namespace.equals(schema.getSchema().getTargetNamespace()))) {
return schema.getSchema();
}
}
}
}
}
} else {
return super.getXSDSchemaFromNamespace(namespace);
}
}
return super.getXSDSchemaFromNamespace(namespace);
}
开发者ID:Talend,项目名称:tesb-studio-se,代码行数:29,代码来源:WSDLPopulationUtil.java
注:本文中的org.eclipse.xsd.XSDSchema类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论