private static void updateSchemaRefs(XmlSchema parentSchema, String name) { for (Iterator iter = parentSchema.getIncludes().getIterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof XmlSchemaExternal) { XmlSchemaExternal extSchema = (XmlSchemaExternal)obj; String location = extSchema.getSchemaLocation(); if (location.length() > 0 && location.indexOf(":/") < 0 && location.indexOf("?xsd=") < 0) { extSchema.setSchemaLocation(name + "?xsd=" + location); } if (extSchema.getSchema() != null) { updateSchemaRefs(extSchema.getSchema(), name); } } } }
private XmlSchema getSchema(XmlSchema parentSchema, String name) { for (Iterator iter = parentSchema.getIncludes().getIterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof XmlSchemaExternal) { XmlSchemaExternal extSchema = (XmlSchemaExternal)obj; if (extSchema.getSchemaLocation().endsWith(name)) { return extSchema.getSchema(); } else { XmlSchema schema = getSchema(extSchema.getSchema(), name); if (schema != null) { return schema; } } } } return null; }
XmlSchemaObjectCollection includes = xmlSchema.getIncludes();
XmlSchemaObjectCollection includes = xmlSchema.getIncludes();
schema.write(outStream); for (Iterator<?> i = schema.getIncludes().getIterator(); i.hasNext();) { XmlSchemaObject obj = (XmlSchemaObject)i.next(); XmlSchema ext = null;
XmlSchemaObjectCollection includeColl = schemaDef.getIncludes(); Iterator includes = includeColl.getIterator(); while(includes.hasNext()) {
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); } } }
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; }
boolean isWSDLInlineSchema, boolean isMasterSchema) throws RegistryException { XmlSchemaObjectCollection includes = xmlSchema.getIncludes(); SchemaInfo schemaInfo = new SchemaInfo(); schemaInfo.setMasterSchema(isMasterSchema);
for (SchemaInfo schemaInfo: schemas.values()) { XmlSchema schema = schemaInfo.getSchema(); XmlSchemaObjectCollection includes = schema.getIncludes(); if (includes != null) { for (Iterator iter = includes.getIterator(); iter.hasNext();) {
boolean isWSDLInlineSchema, boolean isMasterSchema) throws RegistryException, URISyntaxException { XmlSchemaObjectCollection includes = xmlSchema.getIncludes(); SchemaInfo schemaInfo = new SchemaInfo(); schemaInfo.setMasterSchema(isMasterSchema);
for (SchemaInfo schemaInfo: schemas.values()) { XmlSchema schema = schemaInfo.getSchema(); XmlSchemaObjectCollection includes = schema.getIncludes(); if (includes != null) { for (Iterator iter = includes.getIterator(); iter.hasNext();) {
if (processIncludes) { XmlSchemaObjectCollection includes = xmlSchema.getIncludes();
if (processIncludes) { XmlSchemaObjectCollection includes = xmlSchema.getIncludes();
include.setSourceURI(d.getSourceURI()); include.setSchemaLocation(d.getSourceURI()); facade.getIncludes().add(include); facade.getItems().add(include);
include.setSourceURI(d.getSourceURI()); include.setSchemaLocation(d.getSourceURI()); facade.getIncludes().add(include); facade.getItems().add(include);