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

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

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

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

/**
   * Returns all the types defined in <param>schema</param> whose names are 
   * included in the specified set of names.
   * <p>
   * If <tt>names</tt> is null or empty all types are returned.
   * </p>
   * @param schema the schema.
   * @param names the names of types to include.
   * 
   * @return A list of types, including anonymous complex types.
   */
  public static List types( XSDSchema schema, Set names ) {
    List allTypes = allTypes( schema );
    if ( names != null && !names.isEmpty() ) {
      for (Iterator t = allTypes.iterator(); t.hasNext(); ) {
        XSDTypeDefinition type = (XSDTypeDefinition) t.next();
        if ( type.getName() != null && names.contains(type.getName())) {
          continue;
        }
        
        t.remove();
      }
    }
    
    return allTypes;
  }
}

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

protected void buildComplexTypeIndex() {
  complexTypeIndex = 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 XSDComplexTypeDefinition) {
        QName qName = new QName(type.getTargetNamespace(), type.getName());
        complexTypeIndex.put(qName, type);
      }
    }
  }
}

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

@Override
public AttributeType buildSuper() {
  XSDTypeDefinition baseType = xsdType.getBaseType();
  if (baseType != null && baseType.getName() != null && !baseType.equals(xsdType)) {
    return createType(baseType, DUMMY_DEPTH);
  } else {
    return null;
  }
}

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

@Override
  public AttributeType buildSuper() {
    XSDTypeDefinition baseType = xsdType.getBaseType();
    if (baseType != null && baseType.getName() != null && !baseType.equals(xsdType)) {
      return createType(baseType, Integer.MAX_VALUE);
    } else {
      return null;
    }
  }
};

代码示例来源: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

protected final AttributeType xsAnyType() {
  XSDSchema schema = XSDUtil.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
  for ( Iterator i = schema.getTypeDefinitions().iterator(); i.hasNext(); ) {
    XSDTypeDefinition t = (XSDTypeDefinition) i.next();
    if ( XS.ANYTYPE.getLocalPart().equals( t.getName() ) ) {
      return findType(t);
    }
  }
  throw new IllegalStateException("XS schema not present");
}

代码示例来源: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: geotools/geotools

/**
 * Provide an explicit mapping from an XSD type
 * @param namespace
 * @param name
 */
public void addTypeMapping(String namespace, String name,
  AttributeType gtType) {
  if (namespace == null) {
    namespace = schema.getTargetNamespace();
  }
  assert name != null;
  //find the type in the xsd schema
  List typeDefs = schema.getTypeDefinitions();
  for (Iterator itr = typeDefs.iterator(); itr.hasNext();) {
    XSDTypeDefinition xsdType = (XSDTypeDefinition) itr.next();
    String tns = xsdType.getTargetNamespace();
    String tn = xsdType.getName();
    if (namespace.equals(tns) && name.equals(tn)) {
      types.put(xsdType, gtType);
      return;
    }
  }
  throw new IllegalArgumentException("Type: [" + namespace + "," + name
    + "] not found");
}

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

/**
 * Returns <code>true</code> if <code>typeDefinition</code> is derived from a type named <code>
 * superTypeName</code>
 *
 * @param typeDefinition
 * @param superTypeName
 * @return
 */
private static boolean isDerivedFrom(
    XSDTypeDefinition typeDefinition, final Name superTypeName) {
  XSDTypeDefinition baseType;
  final String superNS = superTypeName.getNamespaceURI();
  final String superName = superTypeName.getLocalPart();
  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)) {
      return false;
    }
    if (superNS.equals(targetNamespace) && superName.equals(name)) {
      return true;
    }
    typeDefinition = baseType;
  }
  return false;
}

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

if (type.getName() == null) continue;
String typeQName = prefix.toUpperCase()+"."+type.getName();
String binding = type.getName().substring(0,1).toUpperCase() + 
  type.getName().substring(1) + "Binding.class";

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

for (Iterator itr = types.iterator(); itr.hasNext();) {
  XSDTypeDefinition type = (XSDTypeDefinition)itr.next();
  if (type.getName() == null) continue;
  if (!ns.equals(type.getTargetNamespace())) continue;
stringBuffer.append(type.getName());
stringBuffer.append(TEXT_13);
stringBuffer.append(ns);
stringBuffer.append(TEXT_14);
stringBuffer.append(type.getName());
stringBuffer.append(TEXT_15);

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

XSDTypeDefinition xsdType = (XSDTypeDefinition) itr.next();
if (xsdType.getName() == null) {
  continue;
  logger.fine(xsdType.getName());
  createType((XSDSimpleTypeDefinition) xsdType, 0);
XSDTypeDefinition xsdType = (XSDTypeDefinition) itr.next();
if (xsdType.getName() == null) {
  continue;
  logger.fine(xsdType.getName());
  try {
  createType((XSDComplexTypeDefinition) xsdType, 0);

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

protected AttributeType createType( XSDSimpleTypeDefinition xsdType, int depth ) {
  if (types.containsKey(xsdType)) {
    return (AttributeType) types.get(xsdType);
  }
  //import?
  if (!xsdType.getTargetNamespace().equals(schema.getTargetNamespace())) {
    return (AttributeType) findType(xsdType);
  }
  //first build super type
  AttributeType superType = null;
  XSDTypeDefinition baseType = xsdType.getBaseType();
  if ((baseType != null) && !baseType.equals(xsdType)) {
    if (baseType.getName() != null) {
      //ignore unamed types
      //superType = createType((XSDSimpleTypeDefinition)baseType);
      superType = createType(baseType, depth+1);
      assert superType != null;
    }
  }
  //TODO: actually derive valus from type
  AttributeType gtType = factory.createAttributeType(
    name(xsdType), Object.class, false, false, Collections.EMPTY_LIST, 
    superType, null
  );
  types.put(xsdType, gtType);
  return gtType;
}

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

element.getAnonymousTypeDefinition().setName( type.getName() + "_" + element.getName() );
anonymous.add( element.getAnonymousTypeDefinition() );

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

} else if (!boundedBy.equals(contentName)) {
  XSDTypeDefinition contentType = content.getTypeDefinition();
  if (contentType.getName() == null) {
    while (contentType != null && contentType.getName() == null) {
      XSDTypeDefinition baseType = contentType.getBaseType();
      if (contentType.equals(baseType)) {
      new QName(contentType.getTargetNamespace(), contentType.getName());

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

if (type.getName() != null) {
  bindingName = new QName(type.getTargetNamespace(), type.getName());
} else {
      if (container.getName() == null) {
        if (container.getContainer() instanceof XSDElementDeclaration) {
          XSDElementDeclaration e =

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

if (childElement
    .getType()
    .getName()
    .equals(complex.getType().getName().getLocalPart())) {

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

Name typeName = Types.typeName(typeDef.getTargetNamespace(), typeDef.getName());
AttributeType attType = typeRegistry.get(typeName);

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

if (hasToBeRegistered) {
  String targetNamespace = typeDefinition.getTargetNamespace();
  String name = typeDefinition.getName();
  Name typeName = Types.typeName(targetNamespace, name);
  type = getAttributeType(typeName, typeDefinition, crs);

相关文章