org.eclipse.xsd.XSDTypeDefinition类的使用及代码示例

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

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

XSDTypeDefinition介绍

[英]A representation of the model object 'Type Definition'. It is used to represent aspects common to ' org.eclipse.xsd.XSDSimpleTypeDefinition' and ' org.eclipse.xsd.XSDComplexTypeDefinition'.

The following features are supported:

  • org.eclipse.xsd.XSDTypeDefinition#getAnnotation
  • org.eclipse.xsd.XSDTypeDefinition#getDerivationAnnotation
  • org.eclipse.xsd.XSDTypeDefinition#getAnnotations
  • org.eclipse.xsd.XSDTypeDefinition#getRootType
  • org.eclipse.xsd.XSDTypeDefinition#getBaseType
  • org.eclipse.xsd.XSDTypeDefinition#getSimpleType
  • org.eclipse.xsd.XSDTypeDefinition#getComplexType
    [中]模型对象“类型定义”的表示形式。它用于表示“组织”的共同方面。日食xsd。XSDSimpleTypeDefinition和org。日食xsd。XSDComplexTypeDefinition”。
    支持以下功能:
    *组织。日食xsd。XSDTypeDefinition#getAnnotation
    *组织。日食xsd。XSDTypeDefinition#GetDiversionAnnotation
    *组织。日食xsd。XSDTypeDefinition#getAnnotations
    *组织。日食xsd。XSDTypeDefinition#getRootType
    *组织。日食xsd。XSDTypeDefinition#getBaseType
    *组织。日食xsd。XSDTypeDefinition#getSimpleType
    *组织。日食xsd。XSDTypeDefinition#getComplexType

代码示例

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

protected void buildSimpleTypeIndex() {
  simpleTypeIndex = new HashMap();
  for (int i = 0; i < schemas.length; i++) {
    XSDSchema schema = schemas[i];
    for (Iterator t = schema.getTypeDefinitions().iterator(); t.hasNext(); ) {
      XSDTypeDefinition type = (XSDTypeDefinition) t.next();
      if (type instanceof XSDSimpleTypeDefinition) {
        QName qName = new QName(type.getTargetNamespace(), type.getName());
        simpleTypeIndex.put(qName, type);
      }
    }
  }
}

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

if (type.getName() != null) {
  bindingName = new QName(type.getTargetNamespace(), type.getName());
} else {
  for (Iterator e = type.getSchema().getElementDeclarations().iterator(); e.hasNext(); ) {
    XSDElementDeclaration element = (XSDElementDeclaration) e.next();
      bindingName = new QName(type.getTargetNamespace(), "_" + element.getName());
      if (container.getName() == null) {
        if (container.getContainer() instanceof XSDElementDeclaration) {
          XSDElementDeclaration e =
              (XSDElementDeclaration) container.getContainer();
      if (type.getContainer() instanceof XSDElementDeclaration) {
        XSDElementDeclaration anonymous =
            (XSDElementDeclaration) type.getContainer();
        XSDParticle particle =
            Schemas.getChildElementParticle(
        && type.getBaseType() instanceof XSDSimpleTypeDefinition) {

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

public int length(XSDTypeDefinition definition) {
  try {
    XSDSimpleTypeDefinition simple = definition.getSimpleType();
    XSDLengthFacet facet = simple.getLengthFacet();
    if (facet == null) {
      return Integer.MAX_VALUE;
    }
    return Integer.parseInt(facet.getLexicalValue());
  } catch (NumberFormatException ignore) {
    return Integer.MIN_VALUE;
  }
}

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

/**
 * Returns true if the <code>typeDefinition</code> is based on provided <code>superNS</code>.
 *
 * @param typeDefinition
 * @param superNS
 * @return
 */
private static boolean isBasedOn(XSDTypeDefinition typeDefinition, final String superNS) {
  XSDTypeDefinition baseType;
  String targetNamespace;
  String name;
  while ((baseType = typeDefinition.getBaseType()) != null) {
    targetNamespace = baseType.getTargetNamespace();
    name = baseType.getName();
    if (XS.NAMESPACE.equals(targetNamespace) && XS.ANYTYPE.getLocalPart().equals(name)) {
      // break the loop or this goes forever
      return false;
    }
    if (superNS.equals(targetNamespace)) {
      return true;
    }
    typeDefinition = baseType;
  }
  return false;
}

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

if (theBaseTypeDefinition != null && (forceResolve || theBaseTypeDefinition.getContainer() == null))
 theBaseTypeDefinition = resolveTypeDefinition(theBaseTypeDefinition.getTargetNamespace(), theBaseTypeDefinition.getName());

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

XSDTypeDefinition baseType = xsdTypeDefinition.getBaseType();
if (baseType == null || 
   !baseType.hasSameNameAndTargetNamespace(xsdTypeDefinition) ||
   resolveTypeDefinition(xsdTypeDefinition.getName()).getContainer() == null)
   xsdTypeDefinition.getName());

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

for (Iterator t = schema.getTypeDefinitions().iterator(); t.hasNext(); ) {
  XSDTypeDefinition typedef = (XSDTypeDefinition) t.next();
  if ((ft.getName() + "_Type").equals(typedef.getName())) {
    type = typedef;
    break;

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

private List types(XSDTypeDefinition base) {
  List types = (List) cache.get(base);
  if (types == null) {
    types = new ArrayList();
    XSDTypeDefinition type = base;
    while (type != null) {
      types.add(type);
      // get the next type
      if (type.equals(type.getBaseType())) {
        break;
      }
      type = type.getBaseType();
    }
    cache.put(base, types);
  }
  return types;
}

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

public IType getSuperType()
{
 XSDTypeDefinition td = getXSDTypeDefinition().getBaseType();
 // test to filter out the 'anyType' type ... don't want to see that
 //
 if (td != null && !td.getName().equals("anyType")) //$NON-NLS-1$
 {
  return (IType) XSDAdapterFactory.getInstance().adapt(td);
 }
 return null;
}

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

public static boolean isPrimitiveType(XSDTypeDefinition type)
{
 if (type instanceof XSDComplexTypeDefinition)
  return false;
 XSDTypeDefinition baseType = null;
 if (type != null)
 {
  baseType = type.getBaseType();
  XSDTypeDefinition origType = baseType; // KC: although invalid, we need to
                     // prevent cycles and to avoid an
                     // infinite loop
  while (baseType != null && !XSDConstants.isAnySimpleType(baseType) && !XSDConstants.isAnyType(baseType) && origType != baseType)
  {
   type = baseType;
   baseType = type.getBaseType();
  }
  baseType = type;
 }
 else
 {
  return false;
 }
 return (XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(baseType.getTargetNamespace()));
}

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

} else if (parent.getTargetNamespace() != null) {
  childName = new QName(parent.getTargetNamespace(), child.getName());
} else if (parent.getType().getTargetNamespace() != null) {
  childName =
      new QName(
          parent.getType().getTargetNamespace(), child.getName());
} else {
  childName = new QName(null, child.getName());

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

XSDElementDeclaration element = (XSDElementDeclaration ) e.next();
if ( element.getAnonymousTypeDefinition() != null ) {
  element.getAnonymousTypeDefinition().setName( "_" + element.getName() );
  anonymous.add( element.getAnonymousTypeDefinition() );
    element.getAnonymousTypeDefinition().setName( type.getName() + "_" + element.getName() );
    anonymous.add( element.getAnonymousTypeDefinition() );

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

theBaseTypeDefinition = handleNewBaseTypeDefinition(complexBaseTypeDefinition.getSimpleType());
if (lowestCommonAncestor instanceof XSDSimpleTypeDefinition && lowestCommonAncestor.getContainer() != null)

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

protected List<XSDTypeDefinition> getEcoreTypeQNamesAttribute
 (XSDConcreteComponent xsdConcreteComponent, Element element, String namespace, String attribute)
{
 List<XSDTypeDefinition> result = new ArrayList<XSDTypeDefinition>();
 if (element != null && element.hasAttributeNS(namespace, attribute))
 {
  for (StringTokenizer stringTokenizer = new StringTokenizer(element.getAttributeNS(namespace, attribute)); stringTokenizer.hasMoreTokens(); )
  {
   String qName = stringTokenizer.nextToken();
   XSDTypeDefinition xsdTypeDefinition = xsdConcreteComponent.resolveTypeDefinitionURI(XSDConstants.lookupQName(element, qName));
   if (xsdTypeDefinition.getContainer() != null)
   {
    result.add(xsdTypeDefinition);
   }
  }
 }
 return result;
}

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

/**
 * Returns whether the type definition has the given namespace and name 
 * or is derived from a type with that namespace and name.
 * @param xsdTypeDefinition a type definition.
 * @return  whether the type definition has the given namespace and name or is derived from a type with that namespace and name.
 * @since 2.4
 */
public static boolean isOrIsDerivedFrom(XSDTypeDefinition xsdTypeDefinition, String name, String namespace)
{
 Set<XSDTypeDefinition> visited = new HashSet<XSDTypeDefinition>();
 while (xsdTypeDefinition != null)
 {
  if (xsdTypeDefinition.hasNameAndTargetNamespace(name, namespace))
  {
   return true;
  }
  if (!visited.add(xsdTypeDefinition = xsdTypeDefinition.getBaseType()))
  {
   return false;
  }
 }
 return false;
}

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

if (theTypeDefinition == null || theTypeDefinition.getContainer() == null)
   theTypeDefinition == null ? "" : theTypeDefinition.getURI());
   theTypeDefinition.getBadTypeDerivation
    (substitutionGroupAffiliation.getTypeDefinition(),
     !substitutionGroupExclusions.contains(XSDSubstitutionGroupExclusions.EXTENSION_LITERAL),
     (XSDDiagnosticSeverity.ERROR_LITERAL, "e-props-correct.3", substitutionGroupAffiliation.getTypeDefinition().getURI());
     (XSDDiagnosticSeverity.ERROR_LITERAL, "cos-ct-derived-ok", badTypeDefinition.getURI());

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

XSDWildcard localWildcard = getAttributeWildcardContent();
XSDWildcard baseWildcard = null;
if (theBaseTypeDefinition != null && theBaseTypeDefinition.getContainer() != null)
 if (!((XSDConcreteComponentImpl)theBaseTypeDefinition).analyze() && !XSDConstants.isURType(theBaseTypeDefinition) && theBaseTypeDefinition.isCircular())

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

public void run(){
  if(fSelectedComponent == null){
    return;
  }
  
  if(fSelectedComponent.getSchema() == null){
    getSchema().updateElement(true);
  }
  DocumentImpl doc = (DocumentImpl) fSelectedComponent.getElement().getOwnerDocument();
  doc.getModel().beginRecording(
          this,
          RefactoringWizardMessages.MakeAnonymousTypeGlobalAction_text);
  MakeAnonymousTypeGlobalCommand command = new MakeAnonymousTypeGlobalCommand(
      fSelectedComponent, getNewDefaultName());
  command.run();
  doc.getModel().endRecording(this);
}

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

else if (theBaseTypeDefinition.getContainer() == null)
 createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "_UI_UnresolvedTypeDefinition_message", theBaseTypeDefinition.getURI());
    if (getDerivationMethod() == XSDDerivationMethod.RESTRICTION_LITERAL)
     createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "src-ct.2.2", theBaseTypeDefinition.getURI());
    createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "src-ct.1", theBaseTypeDefinition.getURI());
   if (xsdComplexTypeDefinition.getFinal().contains(XSDComplexFinal.EXTENSION_LITERAL))
    createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "cos-ct-extends.1.1", theBaseTypeDefinition.getURI());

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

xmls.getTransformer().transform(new DOMSource(xsdType.getElement()), new StreamResult(writer));

相关文章