public XmlSchema getSchema(AxisService service, String xsd) throws AxisFault { Parameter wsdlParameter = service.getParameter(WSDLConstants.WSDL_4_J_DEFINITION); if (wsdlParameter != null) { ArrayList list = service.getSchema(); if (list.size() > 0) { if (xsd == null || xsd.length() == 0) { return (XmlSchema) list.get(0); } for (Iterator iterator = list.iterator(); iterator.hasNext();) { XmlSchema schema = (XmlSchema) iterator.next(); XmlSchema[] schemas = SchemaUtil.getAllSchemas(schema); for (int i = 0; i < schemas.length; i++) { String uri = schemas[i].getSourceURI(); if (uri != null && uri.endsWith(xsd)) { return schemas[i]; } } } return (XmlSchema) list.get(0); } } initialize(service); XmlSchema schema = docMap.get(xsd); if (schema == null) { docMap.values().iterator().next(); } return schema; }
public static XmlSchema[] getAllSchemas(XmlSchema schema) { HashMap map = new HashMap(); traverseSchemas(schema, map); return (XmlSchema[]) map.values().toArray(new XmlSchema[map.values().size()]); }
public XmlSchema getSchema(AxisService service, String xsd) throws AxisFault { Parameter wsdlParameter = service.getParameter(WSDLConstants.WSDL_4_J_DEFINITION); if (wsdlParameter != null) { ArrayList list = service.getSchema(); if (list.size() > 0) { if (xsd == null || xsd.length() == 0) { return (XmlSchema) list.get(0); } for (Iterator iterator = list.iterator(); iterator.hasNext();) { XmlSchema schema = (XmlSchema) iterator.next(); XmlSchema[] schemas = SchemaUtil.getAllSchemas(schema); for (int i = 0; i < schemas.length; i++) { String uri = schemas[i].getSourceURI(); if (uri != null && uri.endsWith(xsd)) { return schemas[i]; } } } return (XmlSchema) list.get(0); } } initialize(service); XmlSchema schema = docMap.get(xsd); if (schema == null) { docMap.values().iterator().next(); } return schema; }
public static XmlSchema[] getAllSchemas(XmlSchema schema) { HashMap map = new HashMap(); traverseSchemas(schema, map); return (XmlSchema[]) map.values().toArray(new XmlSchema[map.values().size()]); }
private static String extractNamespace(XmlSchema schema) { String pkg; pkg = schema.getTargetNamespace(); if (pkg == null) { XmlSchema[] schemas2 = SchemaUtil.getAllSchemas(schema); for (int j = 0; schemas2 != null && j < schemas2.length; j++) { pkg = schemas2[j].getTargetNamespace(); if (pkg != null) break; } } if (pkg == null) { pkg = URLProcessor.DEFAULT_PACKAGE; } pkg = URLProcessor.makePackageName(pkg); return pkg; }
private static void traverseSchemas(XmlSchema schema, HashMap map) { String key = schema.getTargetNamespace() + ":" + schema.getSourceURI(); if (map.containsKey(key)) { return; } map.put(key, schema); for (XmlSchemaExternal external : schema.getExternals()) { if (external instanceof XmlSchemaImport) { XmlSchema schema1 = external.getSchema(); if (schema1 != null) { traverseSchemas(schema1, map); } } if (external instanceof XmlSchemaInclude) { XmlSchema schema1 = external.getSchema(); if (schema1 != null) { traverseSchemas(schema1, map); } } } } }
private static String extractNamespace(XmlSchema schema) { String pkg; pkg = schema.getTargetNamespace(); if (pkg == null) { XmlSchema[] schemas2 = SchemaUtil.getAllSchemas(schema); for (int j = 0; schemas2 != null && j < schemas2.length; j++) { pkg = schemas2[j].getTargetNamespace(); if (pkg != null) break; } } if (pkg == null) { pkg = URLProcessor.DEFAULT_PACKAGE; } pkg = URLProcessor.makePackageName(pkg); return pkg; }
private static void traverseSchemas(XmlSchema schema, HashMap map) { String key = schema.getTargetNamespace() + ":" + schema.getSourceURI(); if (map.containsKey(key)) { return; } map.put(key, schema); for (XmlSchemaExternal external : schema.getExternals()) { if (external instanceof XmlSchemaImport) { XmlSchema schema1 = external.getSchema(); if (schema1 != null) { traverseSchemas(schema1, map); } } if (external instanceof XmlSchemaInclude) { XmlSchema schema1 = external.getSchema(); if (schema1 != null) { traverseSchemas(schema1, map); } } } } }
break; XmlSchema[] schemas = SchemaUtil.getAllSchemas(schema); for (int j = 0; schemas != null && j < schemas.length; j++) { nsp = schemas[j].getTargetNamespace();
break; XmlSchema[] schemas = SchemaUtil.getAllSchemas(schema); for (int j = 0; schemas != null && j < schemas.length; j++) { nsp = schemas[j].getTargetNamespace();
options.setLoadAdditionalNamespaces( XmlSchema[] allSchemas = SchemaUtil.getAllSchemas(schema); for (int j = 0; j < allSchemas.length; j++) { completeSchemaList.add(allSchemas[j]);
options.setLoadAdditionalNamespaces( XmlSchema[] allSchemas = SchemaUtil.getAllSchemas(schema); for (int j = 0; j < allSchemas.length; j++) { completeSchemaList.add(allSchemas[j]);