org.eclipse.xsd.XSDSchema.resolveTypeDefinition()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(68)

本文整理了Java中org.eclipse.xsd.XSDSchema.resolveTypeDefinition()方法的一些代码示例,展示了XSDSchema.resolveTypeDefinition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSDSchema.resolveTypeDefinition()方法的具体详情如下:
包路径:org.eclipse.xsd.XSDSchema
类名称:XSDSchema
方法名:resolveTypeDefinition

XSDSchema.resolveTypeDefinition介绍

暂无

代码示例

代码示例来源:origin: geotools/geotools

if (xsd.resolveTypeDefinition(name.getNamespaceURI(), name.getLocalPart())
        == null) {
    xsd.resolveTypeDefinition(name.getNamespaceURI(), name.getLocalPart());
attribute.setTypeDefinition(attributeDefinition);

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

protected XSDComponent getDefinedComponent(XSDSchema schema, String componentName, String componentNamespace)
{
 XSDTypeDefinition result = schema.resolveTypeDefinition(componentNamespace, componentName);
 if (result.eContainer() == null)
 {
  result = null;
 }      
 return result;
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

public XSDTypeDefinition resolveTypeDefinition(String namespace, String localName)
{
 XSDSchema xsdSchema = getSchema();
 if (xsdSchema != null)
 {
  return xsdSchema.resolveTypeDefinition(namespace, localName);
 }
 else
 {
  return createUnresolvedTypeDefinition(namespace, localName);
 }
}

代码示例来源:origin: org.eclipse/org.eclipse.xsd

public XSDTypeDefinition resolveTypeDefinition(String namespace, String localName)
{
 XSDSchema xsdSchema = getSchema();
 if (xsdSchema != null)
 {
  return xsdSchema.resolveTypeDefinition(namespace, localName);
 }
 else
 {
  return createUnresolvedTypeDefinition(namespace, localName);
 }
}

代码示例来源:origin: org.eclipse/org.eclipse.xsd

public XSDTypeDefinition resolveTypeDefinition(String localName)
{
 XSDSchema xsdSchema = getSchema();
 if (xsdSchema != null)
 {
  return xsdSchema.resolveTypeDefinition(xsdSchema.getTargetNamespace(), localName);
 }
 else
 {
  return createUnresolvedTypeDefinition(null, localName);
 }
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

public XSDTypeDefinition resolveTypeDefinition(String localName)
{
 XSDSchema xsdSchema = getSchema();
 if (xsdSchema != null)
 {
  return xsdSchema.resolveTypeDefinition(xsdSchema.getTargetNamespace(), localName);
 }
 else
 {
  return createUnresolvedTypeDefinition(null, localName);
 }
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

protected XSDComplexTypeDefinition createExtendedComplexTypeDefinition(XSDSchema schema, String name, String extension)
{
 XSDComplexTypeDefinition complexType = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
 complexType.setName(name);
 complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
 complexType.setBaseTypeDefinition(schema.resolveTypeDefinition(extension));
 return complexType;
}

代码示例来源:origin: org.eclipse/org.eclipse.xsd

protected XSDComplexTypeDefinition createExtendedComplexTypeDefinition(XSDSchema schema, String name, String extension)
{
 XSDComplexTypeDefinition complexType = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
 complexType.setName(name);
 complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
 complexType.setBaseTypeDefinition(schema.resolveTypeDefinition(extension));
 return complexType;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

public void visitSchema(XSDSchema schema)
{
 if (segment != null)
 {
  if (segment.kind == PathSegment.ELEMENT)
  {
   XSDElementDeclaration ed = schema.resolveElementDeclaration(segment.name);
   if (ed != null)
   {
    visitElementDeclaration(ed);
   }
  }
  else if (segment.kind == PathSegment.TYPE)
  {
   XSDTypeDefinition td = schema.resolveTypeDefinition(segment.name);
   if (td != null)
   {
    visitTypeDefinition(td);
   }
  }
 }
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

protected XSDTypeDefinition typeInOtherSchema(EClassifier classifier)
{
 EPackage typePkg = classifier.getEPackage();
 Map<String, String> namespaces = xsdSchema.getQNamePrefixToNamespaceMap();
 String nsPrefix = getUniqueNsPrefix(typePkg);
 if (namespaces.get(nsPrefix) == null)
 {
  namespaces.put(nsPrefix, typePkg.getNsURI());
  addImport(typePkg.getNsURI(), getName(typePkg) + ".xsd");
  createOtherSchema(typePkg);
 }
 XSDSchema otherXSDSchema = ePackageToXSDSchemaMap.get(typePkg);
 return otherXSDSchema.resolveTypeDefinition(getName(classifier));
}

代码示例来源:origin: org.eclipse/org.eclipse.xsd

protected XSDTypeDefinition typeInOtherSchema(EClassifier classifier)
{
 EPackage typePkg = classifier.getEPackage();
 Map<String, String> namespaces = xsdSchema.getQNamePrefixToNamespaceMap();
 String nsPrefix = getUniqueNsPrefix(typePkg);
 if (namespaces.get(nsPrefix) == null)
 {
  namespaces.put(nsPrefix, typePkg.getNsURI());
  addImport(typePkg.getNsURI(), getName(typePkg) + ".xsd");
  createOtherSchema(typePkg);
 }
 XSDSchema otherXSDSchema = ePackageToXSDSchemaMap.get(typePkg);
 return otherXSDSchema.resolveTypeDefinition(getName(classifier));
}

代码示例来源:origin: org.geoserver/gs-wfs

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;
}

代码示例来源:origin: org.eclipse/org.eclipse.xsd

@Override
public XSDTypeDefinition resolveTypeDefinition(String namespace, String localName)
{
 XSDTypeDefinition result = 
  (XSDTypeDefinition)resolveNamedComponent(XSDPackage.Literals.XSD_SCHEMA__TYPE_DEFINITIONS, namespace, localName);
 if (result == null && 
    XSDConstants.isSchemaForSchemaNamespace(namespace) &&
    !XSDConstants.isSchemaForSchemaNamespace(getTargetNamespace()))
 {
  result = getSchemaForSchema(namespace).resolveTypeDefinition(namespace, localName);
 }
 if (result == null)
 {
  result =  createUnresolvedTypeDefinition(namespace, localName);
 }
 return result;
}

代码示例来源:origin: org.eclipse/org.eclipse.xsd

schema.resolveTypeDefinition(namespace, localName);

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

@Override
public XSDTypeDefinition resolveTypeDefinition(String namespace, String localName)
{
 XSDTypeDefinition result = 
  (XSDTypeDefinition)resolveNamedComponent(XSDPackage.Literals.XSD_SCHEMA__TYPE_DEFINITIONS, namespace, localName);
 if (result == null && 
    XSDConstants.isSchemaForSchemaNamespace(namespace) &&
    !XSDConstants.isSchemaForSchemaNamespace(getTargetNamespace()))
 {
  result = getSchemaForSchema(namespace).resolveTypeDefinition(namespace, localName);
 }
 if (result == null)
 {
  result =  createUnresolvedTypeDefinition(namespace, localName);
 }
 return result;
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

protected void setReferenceElementType(EReference reference, XSDElementDeclaration xsdElementDeclaration)
{
 if (reference.getEType() != null)
 {
  XSDTypeDefinition type;
  if (reference.getEType().getEPackage() == ePackage)
  {
   type = xsdSchema.resolveTypeDefinition(getName(reference.getEType()));
  }
  else
  {
   type = typeInOtherSchema(reference.getEType());
  }
  if (type != null)
  {
   xsdElementDeclaration.setTypeDefinition(type);
  }
 }
}

代码示例来源:origin: org.eclipse/org.eclipse.xsd

protected void setReferenceElementType(EReference reference, XSDElementDeclaration xsdElementDeclaration)
{
 if (reference.getEType() != null)
 {
  XSDTypeDefinition type;
  if (reference.getEType().getEPackage() == ePackage)
  {
   type = xsdSchema.resolveTypeDefinition(getName(reference.getEType()));
  }
  else
  {
   type = typeInOtherSchema(reference.getEType());
  }
  if (type != null)
  {
   xsdElementDeclaration.setTypeDefinition(type);
  }
 }
}

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

xsdComplexTypeDefinition.setBaseTypeDefinition(xsdSchema.resolveTypeDefinition(getName(superClass)));

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

protected void handleAnalysis()
{
 if (!isElementDeclarationReference())
 {
  XSDElementDeclaration theSubstitutionGroupAffiliation = getSubstitutionGroupAffiliation();
  if (theSubstitutionGroupAffiliation != null && theSubstitutionGroupAffiliation.getContainer() != null)
  {
   ((XSDConcreteComponentImpl)theSubstitutionGroupAffiliation).analyze();
  }

  XSDTypeDefinition theTypeDefinition = getTypeDefinition();
  if (!isTypeExplicit || theTypeDefinition == null)
  {
   XSDTypeDefinition newTypeDefinition =
    theSubstitutionGroupAffiliation == null || theSubstitutionGroupAffiliation.getTypeDefinition() == null ?
     getSchema().getSchemaForSchema().resolveTypeDefinition("anyType") :
     theSubstitutionGroupAffiliation.getTypeDefinition();
   if (newTypeDefinition != theTypeDefinition)
   {
    isTypeExplicit = false;
    setTypeDefinitionGen(newTypeDefinition);
   }
  }
 }
 super.analyze();
}

代码示例来源:origin: org.eclipse/org.eclipse.xsd

protected void handleAnalysis()
{
 if (!isElementDeclarationReference())
 {
  XSDElementDeclaration theSubstitutionGroupAffiliation = getSubstitutionGroupAffiliation();
  if (theSubstitutionGroupAffiliation != null && theSubstitutionGroupAffiliation.getContainer() != null)
  {
   ((XSDConcreteComponentImpl)theSubstitutionGroupAffiliation).analyze();
  }

  XSDTypeDefinition theTypeDefinition = getTypeDefinition();
  if (!isTypeExplicit || theTypeDefinition == null)
  {
   XSDTypeDefinition newTypeDefinition =
    theSubstitutionGroupAffiliation == null || theSubstitutionGroupAffiliation.getTypeDefinition() == null ?
     getSchema().getSchemaForSchema().resolveTypeDefinition("anyType") :
     theSubstitutionGroupAffiliation.getTypeDefinition();
   if (newTypeDefinition != theTypeDefinition)
   {
    isTypeExplicit = false;
    setTypeDefinitionGen(newTypeDefinition);
   }
  }
 }
 super.analyze();
}

相关文章

微信公众号

最新文章

更多