/** * Get a schema from an import * * @param includeOrImport * @return return the schema object. */ private XmlSchema getSchema(Object includeOrImport) { XmlSchema schema; if (includeOrImport instanceof XmlSchemaImport) { schema = ((XmlSchemaImport) includeOrImport).getSchema(); } else if (includeOrImport instanceof XmlSchemaInclude) { schema = ((XmlSchemaInclude) includeOrImport).getSchema(); } else { // skip ? schema = null; } return schema; }
/** * Get a schema from an import * * @param includeOrImport * @return return the schema object. */ private XmlSchema getSchema(Object includeOrImport) { XmlSchema schema; if (includeOrImport instanceof XmlSchemaImport) { schema = ((XmlSchemaImport) includeOrImport).getSchema(); } else if (includeOrImport instanceof XmlSchemaInclude) { schema = ((XmlSchemaInclude) includeOrImport).getSchema(); } else { // skip ? schema = null; } return schema; }
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 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 void findImports(XmlSchema schema, Set<XmlSchema> processedImports, Set<XmlSchema> processedIncludes) { processedImports.add(schema); XmlSchemaObjectCollection includes = schema.getIncludes(); for (int i = 0; i < includes.getCount(); i++) { XmlSchemaExternal external = (XmlSchemaExternal) includes.getItem(i); 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); } } }
ext = ((XmlSchemaImport)obj).getSchema();
private static <T extends XmlSchemaObject> T getXmlSchemaObject(XmlSchema schema, QName name, Class<T> type) { if (schema != null) { XmlSchemaObject object = null; if (type == XmlSchemaElement.class) { object = schema.getElementByName(name); } else if (type == XmlSchemaType.class) { object = schema.getTypeByName(name); } if (object != null) { return type.cast(object); } for (Iterator<?> i = schema.getIncludes().getIterator(); i.hasNext();) { XmlSchemaObject obj = (XmlSchemaObject)i.next(); XmlSchema ext = null; if (obj instanceof XmlSchemaInclude) { ext = ((XmlSchemaInclude)obj).getSchema(); } if (obj instanceof XmlSchemaImport) { ext = ((XmlSchemaImport)obj).getSchema(); } object = getXmlSchemaObject(ext, name, type); if (object != null) { return type.cast(object); } } } return null; }
private static <T extends XmlSchemaObject> T getXmlSchemaObject(XmlSchema schema, QName name, Class<T> type) { if (schema != null) { XmlSchemaObject object = null; if (type == XmlSchemaElement.class) { object = schema.getElementByName(name); } else if (type == XmlSchemaType.class) { object = schema.getTypeByName(name); } if (object != null) { return type.cast(object); } for (Iterator<?> i = schema.getIncludes().getIterator(); i.hasNext();) { XmlSchemaObject obj = (XmlSchemaObject)i.next(); XmlSchema ext = null; if (obj instanceof XmlSchemaInclude) { ext = ((XmlSchemaInclude)obj).getSchema(); } if (obj instanceof XmlSchemaImport) { ext = ((XmlSchemaImport)obj).getSchema(); } object = getXmlSchemaObject(ext, name, type); if (object != null) { return type.cast(object); } } } return null; }
private static XmlSchemaType findSchemaType(XmlSchema xmlSchema, QName typeName) { XmlSchemaType schemaType = xmlSchema.getTypeByName(typeName); // Endpoint reference types will give a null schemaType // here, so we need to // go through the list of imports to find the definition for // an Endpoint // reference type. if (schemaType == null) { for (XmlSchemaExternal ext : xmlSchema.getExternals()) { if (ext instanceof XmlSchemaImport) { XmlSchemaImport xmlImport = (XmlSchemaImport)ext; if (xmlImport.getNamespace().equals(typeName.getNamespaceURI())) { XmlSchema importSchema = xmlImport.getSchema(); schemaType = importSchema.getTypeByName(typeName); } else { schemaType = findSchemaType(ext.getSchema(), typeName); if (schemaType != null) { return schemaType; } } } } if (schemaType != null) { return schemaType; } } return schemaType; }
private XmlSchemaElement getSchemaElement(XmlSchema schema) { XmlSchemaElement xmlSchemaElement = null; if (schema != null) { xmlSchemaElement = schema.getElementByName(this.elementQname); if (xmlSchemaElement == null) { // try to find in an import or an include for (XmlSchemaObject external : schema.getExternals()) { if (external instanceof XmlSchemaImport) { XmlSchema schema1 = ((XmlSchemaImport) external).getSchema(); xmlSchemaElement = getSchemaElement(schema1); } if (external instanceof XmlSchemaInclude) { XmlSchema schema1 = ((XmlSchemaInclude) external).getSchema(); xmlSchemaElement = getSchemaElement(schema1); } if (xmlSchemaElement != null) { break; } } } } return xmlSchemaElement; }
private 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 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 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 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 XmlSchemaElement getSchemaElement(XmlSchema schema) { XmlSchemaElement xmlSchemaElement = null; if (schema != null) { xmlSchemaElement = schema.getElementByName(this.elementQname); if (xmlSchemaElement == null) { // try to find in an import or an include for (XmlSchemaObject external : schema.getExternals()) { if (external instanceof XmlSchemaImport) { XmlSchema schema1 = ((XmlSchemaImport) external).getSchema(); xmlSchemaElement = getSchemaElement(schema1); } if (external instanceof XmlSchemaInclude) { XmlSchema schema1 = ((XmlSchemaInclude) external).getSchema(); xmlSchemaElement = getSchemaElement(schema1); } if (xmlSchemaElement != null) { break; } } } } return xmlSchemaElement; }
private XmlSchemaElement getSchemaElement(org.apache.ws.commons.schema.XmlSchema schema, QName elementQName) { XmlSchemaElement xmlSchemaElement = null; if (schema != null) { xmlSchemaElement = schema.getElementByName(elementQName); if (xmlSchemaElement == null) { // try to find in an import or an include for (XmlSchemaObject object : schema.getExternals()) { if (object instanceof XmlSchemaImport) { org.apache.ws.commons.schema.XmlSchema schema1 = ((XmlSchemaImport) object).getSchema(); xmlSchemaElement = getSchemaElement(schema1, elementQName); } if (object instanceof XmlSchemaInclude) { org.apache.ws.commons.schema.XmlSchema schema1 = ((XmlSchemaInclude) object).getSchema(); xmlSchemaElement = getSchemaElement(schema1, elementQName); } if (xmlSchemaElement != null) { break; } } } } return xmlSchemaElement; } }
XmlSchema schema1 = schemaImport.getSchema(); if (schema1 != null) { compile(schema1, isPartofGroup);
XmlSchema schema1 = schemaImport.getSchema(); if (schema1 != null) { compile(schema1, isPartofGroup);