private boolean isExistImport(XmlSchema schema, String ns) { boolean isExist = false; for (XmlSchemaExternal ext : schema.getExternals()) { if (ext instanceof XmlSchemaImport) { XmlSchemaImport xsImport = (XmlSchemaImport)ext; if (xsImport.getNamespace().equals(ns)) { isExist = true; break; } } } return isExist; }
private boolean isExistImport(XmlSchema schema, String ns) { boolean isExist = false; for (XmlSchemaExternal ext : schema.getExternals()) { if (ext instanceof XmlSchemaImport) { XmlSchemaImport xsImport = (XmlSchemaImport)ext; if (xsImport.getNamespace().equals(ns)) { isExist = true; break; } } } return isExist; }
private boolean isExistImport(XmlSchema schema, String ns) { boolean isExist = false; for (XmlSchemaExternal ext : schema.getExternals()) { if (ext instanceof XmlSchemaImport) { XmlSchemaImport xsImport = (XmlSchemaImport)ext; if (xsImport.getNamespace().equals(ns)) { isExist = true; break; } } } return isExist; }
/** * Is there an import for a particular namespace in a schema? * @param schema * @param namespaceUri */ public static boolean schemaImportsNamespace(XmlSchema schema, String namespaceUri) { List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal what : externals) { if (what instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)what; // already there. if (namespaceUri.equals(imp.getNamespace())) { return true; } } } return false; }
/** * Is there an import for a particular namespace in a schema? * @param schema * @param namespaceUri */ public static boolean schemaImportsNamespace(XmlSchema schema, String namespaceUri) { List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal what : externals) { if (what instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)what; // already there. if (namespaceUri.equals(imp.getNamespace())) { return true; } } } return false; }
/** * Is there an import for a particular namespace in a schema? * @param schema * @param namespaceUri * @return */ public static boolean schemaImportsNamespace(XmlSchema schema, String namespaceUri) { List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal what : externals) { if (what instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)what; // already there. if (namespaceUri.equals(imp.getNamespace())) { return true; } } } return false; }
/** * Is there an import for a particular namespace in a schema? * @param schema * @param namespaceUri */ public static boolean schemaImportsNamespace(XmlSchema schema, String namespaceUri) { List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal what : externals) { if (what instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)what; // already there. if (namespaceUri.equals(imp.getNamespace())) { return true; } } } return false; }
/** * Is there an import for a particular namespace in a schema? * @param schema * @param namespaceUri */ public static boolean schemaImportsNamespace(XmlSchema schema, String namespaceUri) { List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal what : externals) { if (what instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)what; // already there. if (namespaceUri.equals(imp.getNamespace())) { return true; } } } return false; }
private void updateSchemaLocation(XmlSchema schema) throws AxisFault { for (XmlSchemaExternal xmlSchemaExternal : schema.getExternals()) { XmlSchema s = xmlSchemaExternal.getSchema(); updateSchemaLocation(s, xmlSchemaExternal); } }
private void updateSchemaLocation(XmlSchema schema) throws AxisFault { for (XmlSchemaExternal xmlSchemaExternal : schema.getExternals()) { XmlSchema s = xmlSchemaExternal.getSchema(); updateSchemaLocation(s, xmlSchemaExternal); } }
/** * Adjust a single schema * * @param parentSchema * @param nameTable */ private void adjustSchemaName(XmlSchema parentSchema, Hashtable nameTable, Hashtable importedScheams, Hashtable sourceURIToNewLocationMap) { for (XmlSchemaExternal xmlSchemaExternal : parentSchema.getExternals()) { XmlSchema s = xmlSchemaExternal.getSchema(); adjustSchemaLocation(s, xmlSchemaExternal, nameTable, importedScheams, sourceURIToNewLocationMap); } }
/** * Adjust a single schema * * @param parentSchema * @param nameTable */ private void adjustSchemaName(XmlSchema parentSchema, Hashtable nameTable, Hashtable importedScheams, Hashtable sourceURIToNewLocationMap) { for (XmlSchemaExternal xmlSchemaExternal : parentSchema.getExternals()) { XmlSchema s = xmlSchemaExternal.getSchema(); adjustSchemaLocation(s, xmlSchemaExternal, nameTable, importedScheams, sourceURIToNewLocationMap); } }
public static boolean isElementFormQualified(XmlSchema schema, QName type) { if (type != null) { String uri = type.getNamespaceURI(); if (uri.equals(schema.getTargetNamespace())) { return schema.getElementFormDefault() == XmlSchemaForm.QUALIFIED; } for (XmlSchemaExternal extSchema : schema.getExternals()) { return isElementFormQualified(extSchema.getSchema(), type); } } return false; }
private static boolean isAttributeFormQualified(XmlSchema schema, String uri) { if (uri.equals(schema.getTargetNamespace())) { return schema.getAttributeFormDefault() == XmlSchemaForm.QUALIFIED; } for (XmlSchemaExternal extSchema : schema.getExternals()) { return isAttributeFormQualified(extSchema.getSchema(), uri); } return false; }
private void findImports(XmlSchema schema, Set<XmlSchema> processedImports, Set<XmlSchema> processedIncludes) { processedImports.add(schema); List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal external : externals) { if (external instanceof XmlSchemaImport) { XmlSchemaImport schemaImport = (XmlSchemaImport) external; XmlSchema importedSchema = schemaImport.getSchema(); if (!"http://www.w3.org/XML/1998/namespace".equals(schemaImport.getNamespace()) && importedSchema != null && !processedImports.contains(importedSchema)) { inlineIncludes(importedSchema, processedIncludes, processedImports); findImports(importedSchema, processedImports, processedIncludes); xmlSchemas.add(importedSchema); } // remove the schemaLocation external.setSchemaLocation(null); } } }
private static boolean isElementFormQualified(XmlSchema schema, String uri) { if (uri.equals(schema.getTargetNamespace())) { return schema.getElementFormDefault() == XmlSchemaForm.QUALIFIED; } for (XmlSchemaExternal extSchema : schema.getExternals()) { return isElementFormQualified(extSchema.getSchema(), uri); } return false; }
private static XmlSchemaElement findElement(XmlSchema xmlSchema, QName elName) { XmlSchemaElement schemaElement = null; schemaElement = xmlSchema.getElementByName(elName); if (schemaElement == null) { String prefix = definition.getPrefix(elName.getNamespaceURI()); QName name = new QName(elName.getNamespaceURI(), prefix + ":" + elName.getLocalPart(), prefix); schemaElement = xmlSchema.getElementByName(name); } if (schemaElement != null) { return schemaElement; } for (XmlSchemaExternal ext : xmlSchema.getExternals()) { if (!(ext instanceof XmlSchemaImport)) { schemaElement = findElement(ext.getSchema(), elName); if (schemaElement != null) { return schemaElement; } } } return schemaElement; }
private void addCorbaTypes(Definition definition) throws Exception { for (XmlSchema xmlSchemaTypes : xmlSchemaList.getXmlSchemas()) { for (XmlSchemaExternal ext : xmlSchemaTypes.getExternals()) { addCorbaTypes(ext.getSchema()); // REVISIT: This was preventing certain types from being added to the corba // typemap even when they are referenced from other parts of the wsdl. // // Should this add the corba types if it IS an instance of the XmlSchemaImport // (and not an XmlSchemaInclude or XmlSchemaRedefine)? //if (!(extSchema instanceof XmlSchemaImport)) { // addCorbaTypes(extSchema.getSchema()); //} } if (!W3CConstants.NU_SCHEMA_XSD.equals(xmlSchemaTypes.getTargetNamespace())) { addCorbaTypes(xmlSchemaTypes); } } }
private static XmlSchemaType getSchemaType(XmlSchema schema, QName typeName) { XmlSchemaType xmlSchemaType = null; if (schema != null) { xmlSchemaType = schema.getTypeByName(typeName); if (xmlSchemaType == null) { // try to find in an import or an include) { for (XmlSchemaObject object : schema.getExternals()) { if (object instanceof XmlSchemaImport) { XmlSchema schema1 = ((XmlSchemaImport) object).getSchema(); xmlSchemaType = getSchemaType(schema1, typeName); } if (object instanceof XmlSchemaInclude) { XmlSchema schema1 = ((XmlSchemaInclude) object).getSchema(); xmlSchemaType = getSchemaType(schema1, typeName); } if (xmlSchemaType != null) { break; } } } } return xmlSchemaType; }
private XmlSchemaType findTypeInSchema(XmlSchema xmlSchema, QName typeName) { XmlSchemaType schemaType = null; if (xmlSchema.getElementByName(typeName) != null) { XmlSchemaElement schemaElement = xmlSchema.getElementByName(typeName); schemaType = schemaElement.getSchemaType(); } else if (xmlSchema.getTypeByName(typeName) != null) { schemaType = xmlSchema.getTypeByName(typeName); } if (schemaType != null) { return schemaType; } for (XmlSchemaExternal extSchema : xmlSchema.getExternals()) { if (!(extSchema instanceof XmlSchemaImport)) { schemaType = findTypeInSchema(extSchema.getSchema(), typeName); if (schemaType != null) { return schemaType; } } } return null; }