namespaceURI = xsdSchema.getTargetNamespace();
public XSDSchema locateSchema( XSDSchema xsdSchema, String namespaceURI, String rawSchemaLocationURI, String resolvedSchemaLocationURI) { if (importee.getTargetNamespace().equals(namespaceURI)) { return importee; } return null; } });
boolean target(XSDNamedComponent c, XSDSchema schema) { return c.getTargetNamespace().equals(schema.getTargetNamespace()); }
public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); Object[] arguments = (Object[])argument; XSDSchema schema = (XSDSchema)arguments[0]; String namespace = schema.getTargetNamespace(); String prefix = Schemas.getTargetPrefix( schema ).toUpperCase(); stringBuffer.append(TEXT_1); stringBuffer.append(namespace); stringBuffer.append(TEXT_2); stringBuffer.append(prefix); stringBuffer.append(TEXT_3); stringBuffer.append(prefix); stringBuffer.append(TEXT_4); return stringBuffer.toString(); } }
/** * Returns the namespace prefix mapped to the targetNamespace of the schema. * * @param schema The schema in question. * @return The namesapce prefix, or <code>null</code> if not found. */ public static String getTargetPrefix(XSDSchema schema) { String ns = schema.getTargetNamespace(); Map pre2ns = schema.getQNamePrefixToNamespaceMap(); for (Iterator itr = pre2ns.entrySet().iterator(); itr.hasNext(); ) { Map.Entry entry = (Map.Entry) itr.next(); if (entry.getKey() == null) { continue; // default prefix } if (entry.getValue().equals(ns)) { return (String) entry.getKey(); } } return null; }
namespaceURI = xsdSchema.getTargetNamespace();
/** * Resolves <param>location<param> to a physical location. * * <p>Resolution is performed by stripping the filename off of <param>location</param> and * looking up a resource located in the same package as the xsd. */ public String resolveSchemaLocation(XSDSchema schema, String uri, String location) { if (location == null) { return null; } // if no namespace given, assume default for the current schema if (((uri == null) || "".equals(uri)) && (schema != null)) { uri = schema.getTargetNamespace(); } // namespace match? if (canHandle(schema, uri, location)) { return resolveLocationToResource(location).toString(); } return null; }
/** * 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"); }
public int visit(Graphable element, GraphTraversal traversal) { AttributeType type = (AttributeType) element.getObject(); //only add if in this schema if (type.getName().getNamespaceURI().equals(schema.getTargetNamespace())) { sorted.add(element.getObject()); } return GraphTraversal.CONTINUE; }
public String resolveSchemaLocation( XSDSchema xsdSchema, String namespaceURI, String schemaLocationURI) { if (schemaLocationURI == null) { return null; } // if no namespace given, assume default for the current schema if (((namespaceURI == null) || "".equals(namespaceURI)) && (xsdSchema != null)) { namespaceURI = xsdSchema.getTargetNamespace(); } if (ML.NAMESPACE.equals(namespaceURI)) { if (schemaLocationURI.endsWith("mails.xsd")) { return getClass().getResource("mails.xsd").toString(); } } return null; } }
/** * Add the explicit bindings of XSD types to fully-qualified class names. * If a type has a binding, it will be treated as non-complex and bound to * the named class. * * @param typeBindings */ public void setTypeBindings(TypeBinding[] typeBindings) { Map<Name, String> bindings = new HashMap<Name, String>(); if (typeBindings != null) { for (TypeBinding typeBinding : typeBindings) { String namespace = typeBinding.getNamespace(); if (namespace == null) { namespace = schema.getTargetNamespace(); } String name = typeBinding.getName(); if (name == null) { throw new IllegalArgumentException("Missing name for typeBinding"); } String binding = typeBinding.getBinding(); if (binding == null) { throw new IllegalArgumentException("Missing binding for typeBinding for " + name); } bindings.put(new NameImpl(namespace, name), binding); } } this.typeBindings = bindings; }
if (!xsdType.getTargetNamespace().equals(schema.getTargetNamespace())) { return (AttributeType) findType(xsdType);
namespaces.add(schema.getTargetNamespace()); includes.add(file); if( include.getSchema() != null ) { namespaces.add(include.getSchema().getTargetNamespace()); namespaces.add( schema.getTargetNamespace() );
XSDTypeDefinition type = null; String ns = schema.getTargetNamespace(); String prefix = Schemas.getTargetPrefix( schema );
String ns = schema.getTargetNamespace(); if (ns != null && ns.startsWith("http://www.opengis.net/gml")) { throw new RuntimeException(
String ns1 = schema != null ? schema.getTargetNamespace() : null; String ns2 = schema2.getTargetNamespace();
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; }
ns1 = component.getSchema().getTargetNamespace();
.equals(schema.getTargetNamespace())) { continue; .equals(schema.getTargetNamespace())) { continue; Schema gtSchema = new SchemaImpl(schema.getTargetNamespace());
imprt.setNamespace(importee.getTargetNamespace()); schema.getContents().add(imprt);