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); } } } }
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); } } } }
/** * 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; }
/** * 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"); }
/** * 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; }
XSDTypeDefinition type = (XSDTypeDefinition)itr.next(); if (type.getName() == null) continue; if (!ns.equals(type.getTargetNamespace())) continue;
if (!xsdType.getTargetNamespace() .equals(schema.getTargetNamespace())) { continue; if (!xsdType.getTargetNamespace() .equals(schema.getTargetNamespace())) { continue;
} 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());
bindingLoader.loadBinding( new QName( type.getTargetNamespace(), type.getName()), context);
new QName(contentType.getTargetNamespace(), contentType.getName());
String targetNamespace = baseType.getTargetNamespace(); String name = baseType.getName(); if (name != null) { + childDecl.getName() + " from container '" + typeDefinition.getTargetNamespace() + "#" + typeDefinition.getName()
bindingName = new QName(type.getTargetNamespace(), type.getName()); } else { bindingName = new QName(type.getTargetNamespace(), "_" + element.getName());
Name typeName = Types.typeName(typeDef.getTargetNamespace(), typeDef.getName()); AttributeType attType = typeRegistry.get(typeName);
QName qualifiedElementTypeName = new QName( elementTypeDef.getTargetNamespace(), elementTypeDef.getName()); if (qualifiedTypeName.equals(qualifiedElementTypeName)) { type = elementTypeDef;
boolean isAnyType = typeDef.getName() != null && typeDef.getTargetNamespace() != null && typeDef.getName().equals(XS.ANYTYPE.getLocalPart()) && typeDef.getTargetNamespace().equals(XS.NAMESPACE); if (isAnyType) { Collection complexAtts;
String targetNamespace = typeDefinition.getTargetNamespace(); String name = typeDefinition.getName(); Name typeName = Types.typeName(targetNamespace, name);
/** * Returns whether the type definition is the * <a href="http://www.w3.org/TR/xmlschema-2/#dt-anySimpleType">anySimpleType</a>. * @param xsdTypeDefinition a simple or complex type definition. * @return whether the type definition is the anySimpleType. */ public static boolean isAnySimpleType(XSDTypeDefinition xsdTypeDefinition) { return isSchemaForSchemaNamespace(xsdTypeDefinition.getTargetNamespace()) && "anySimpleType".equals(xsdTypeDefinition.getName()); }
/** * Returns whether the type definition is the * <a href="http://www.w3.org/TR/xmlschema-2/#dt-anySimpleType">anySimpleType</a>. * @param xsdTypeDefinition a simple or complex type definition. * @return whether the type definition is the anySimpleType. */ public static boolean isAnySimpleType(XSDTypeDefinition xsdTypeDefinition) { return isSchemaForSchemaNamespace(xsdTypeDefinition.getTargetNamespace()) && "anySimpleType".equals(xsdTypeDefinition.getName()); }
public String getTypeNameQualifier() { XSDTypeDefinition type = getResolvedXSDAttributeDeclaration().getTypeDefinition(); if (type != null) { return type.getTargetNamespace(); } return ""; }
public String getTypeNameQualifier() { XSDTypeDefinition type = getResolvedXSDAttributeDeclaration().getTypeDefinition(); if (type != null) { return type.getTargetNamespace(); } return ""; }