/** * 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; }
continue; XmlSchemaInclude include = new XmlSchemaInclude(); include.setSchema(d); include.setSourceURI(d.getSourceURI()); include.setSchemaLocation(d.getSourceURI()); facade.getIncludes().add(include); facade.getItems().add(include);
Element schemaEl) { XmlSchemaInclude include = new XmlSchemaInclude(); include.setAnnotation(includeAnnotation);
} else if (ext instanceof XmlSchemaInclude) { SchemaReference imp = schemaImpl.createInclude(); imp.setSchemaLocationURI(((XmlSchemaInclude)ext).getSchemaLocation());
continue; XmlSchemaInclude include = new XmlSchemaInclude(); include.setSchema(d); include.setSourceURI(d.getSourceURI()); include.setSchemaLocation(d.getSourceURI()); facade.getIncludes().add(include); facade.getItems().add(include);
Element schemaEl) { XmlSchemaInclude include = new XmlSchemaInclude(); include.setAnnotation(includeAnnotation);
} else if (ext instanceof XmlSchemaInclude) { SchemaReference imp = schemaImpl.createInclude(); imp.setSchemaLocationURI(((XmlSchemaInclude)ext).getSchemaLocation());
/** * 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; }
Element includeEl, Element schemaEl) { XmlSchemaInclude include = new XmlSchemaInclude(); XmlSchemaAnnotation includeAnnotation = handleAnnotation(annotationEl); include.setAnnotation(includeAnnotation);
} else if (ext instanceof XmlSchemaInclude) { SchemaReference imp = schemaImpl.createInclude(); imp.setSchemaLocationURI(((XmlSchemaInclude)ext).getSchemaLocation());
private void inlineIncludes(XmlSchema schema, Set<XmlSchema> processedIncludes, Set<XmlSchema> processedImports) { processedIncludes.add(schema); List<XmlSchemaObject> schemaItems = schema.getItems(); for (int i = 0; i < schemaItems.size(); i++) { XmlSchemaObject schemaObject = schemaItems.get(i); if (schemaObject instanceof XmlSchemaInclude) { XmlSchema includedSchema = ((XmlSchemaInclude) schemaObject).getSchema(); if (!processedIncludes.contains(includedSchema)) { inlineIncludes(includedSchema, processedIncludes, processedImports); findImports(includedSchema, processedImports, processedIncludes); List<XmlSchemaObject> includeItems = includedSchema.getItems(); for (XmlSchemaObject includedItem : includeItems) { schemaItems.add(includedItem); } } // remove the <include/> schemaItems.remove(i); i--; } } }
private void inlineIncludes(XmlSchema schema, Set<XmlSchema> processedIncludes, Set<XmlSchema> processedImports) { processedIncludes.add(schema); List<XmlSchemaObject> schemaItems = schema.getItems(); for (int i = 0; i < schemaItems.size(); i++) { XmlSchemaObject schemaObject = schemaItems.get(i); if (schemaObject instanceof XmlSchemaInclude) { XmlSchema includedSchema = ((XmlSchemaInclude) schemaObject).getSchema(); if (!processedIncludes.contains(includedSchema)) { inlineIncludes(includedSchema, processedIncludes, processedImports); findImports(includedSchema, processedImports, processedIncludes); List<XmlSchemaObject> includeItems = includedSchema.getItems(); for (XmlSchemaObject includedItem : includeItems) { schemaItems.add(includedItem); } } // remove the <include/> schemaItems.remove(i); i--; } } }
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; }
XmlSchema ext = null; if (obj instanceof XmlSchemaInclude) { ext = ((XmlSchemaInclude)obj).getSchema();
XmlSchema includedSchemaObj = includeObj.getSchema(); if (includedSchemaObj != null && serializeIncluded) { XmlSchemaSerializer includeSeri = new XmlSchemaSerializer();
XmlSchema includedSchemaObj = includeObj.getSchema(); if (includedSchemaObj != null && serializeIncluded) { XmlSchemaSerializer includeSeri = new XmlSchemaSerializer();
XmlSchema includedSchemaObj = includeObj.getSchema(); if (includedSchemaObj != null && serializeIncluded) { XmlSchemaSerializer includeSeri = new XmlSchemaSerializer();
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 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; }