private Object getScheamLocationWithDot( Hashtable sourceURIToNewLocationMap, XmlSchema s) { String o = (String) sourceURIToNewLocationMap.get(s.getSourceURI()); if (o != null && o.indexOf(".") < 0) { return o + ".xsd"; } return o; }
private Object getScheamLocationWithDot( Hashtable sourceURIToNewLocationMap, XmlSchema s) { String o = (String) sourceURIToNewLocationMap.get(s.getSourceURI()); if (o != null && o.indexOf(".") < 0) { return o + ".xsd"; } return o; }
public XmlValidator createValidator() throws IOException { Resource[] resources = new Resource[xmlSchemas.size()]; for (int i = xmlSchemas.size() - 1; i >= 0; i--) { XmlSchema xmlSchema = xmlSchemas.get(i); resources[i] = new UrlResource(xmlSchema.getSourceURI()); } return XmlValidatorFactory.createValidator(resources, XmlValidatorFactory.SCHEMA_W3C_XML); }
String sourceURI = s.getSourceURI();
@Override public XmlValidator createValidator() { try { Resource[] resources = new Resource[xmlSchemas.size()]; for (int i = xmlSchemas.size() - 1; i >= 0; i--) { XmlSchema xmlSchema = xmlSchemas.get(i); String sourceUri = xmlSchema.getSourceURI(); if (StringUtils.hasLength(sourceUri)) { resources[i] = new UrlResource(sourceUri); } } return XmlValidatorFactory .createValidator(resources, XmlValidatorFactory.SCHEMA_W3C_XML); } catch (IOException ex) { throw new CommonsXsdSchemaException(ex.getMessage(), ex); } }
public XmlValidator createValidator() throws IOException { Resource resource = new UrlResource(schema.getSourceURI()); return XmlValidatorFactory.createValidator(resource, XmlValidatorFactory.SCHEMA_W3C_XML); }
@Override public XmlValidator createValidator() { try { Resource[] resources = new Resource[xmlSchemas.size()]; for (int i = xmlSchemas.size() - 1; i >= 0; i--) { XmlSchema xmlSchema = xmlSchemas.get(i); String sourceUri = xmlSchema.getSourceURI(); if (StringUtils.hasLength(sourceUri)) { resources[i] = new UrlResource(sourceUri); } } return XmlValidatorFactory .createValidator(resources, XmlValidatorFactory.SCHEMA_W3C_XML); } catch (IOException ex) { throw new CommonsXsdSchemaException(ex.getMessage(), ex); } }
private void addSchema(Map<String, EmbeddedSchema> sources, XmlSchema schema, Element element) throws XMLStreamException { String schemaSystemId = schema.getSourceURI(); if (null == schemaSystemId) { schemaSystemId = schema.getTargetNamespace(); } EmbeddedSchema embeddedSchema = new EmbeddedSchema(schemaSystemId, element); sources.put(schema.getTargetNamespace(), embeddedSchema); }
private void addSchema(Map<String, EmbeddedSchema> sources, XmlSchema schema, Element element) throws XMLStreamException { String schemaSystemId = schema.getSourceURI(); if (null == schemaSystemId) { schemaSystemId = schema.getTargetNamespace(); } EmbeddedSchema embeddedSchema = new EmbeddedSchema(schemaSystemId, element); sources.put(schema.getTargetNamespace(), embeddedSchema); }
@Override public XmlValidator createValidator() { try { Resource resource = new UrlResource(schema.getSourceURI()); return XmlValidatorFactory .createValidator(resource, XmlValidatorFactory.SCHEMA_W3C_XML); } catch (IOException ex) { throw new CommonsXsdSchemaException(ex.getMessage(), ex); } }
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { String s = JAXBDataBinding.mapSchemaLocation(systemId, baseURI, catalog); LOG.fine("validating: " + namespaceURI + " " + systemId + " " + baseURI + " " + s); if (s == null) { XmlSchema sc = schemaCollection.getSchemaByTargetNamespace(namespaceURI); if (sc != null) { StringWriter writer = new StringWriter(); sc.write(writer); InputSource src = new InputSource(new StringReader(writer.toString())); src.setSystemId(sc.getSourceURI()); return new LSInputSAXWrapper(src); } throw new ToolException("Schema not found for namespace: " + namespaceURI); } return new LSInputSAXWrapper(new InputSource(s)); } });
@Override public XmlValidator createValidator() { try { Resource resource = new UrlResource(schema.getSourceURI()); return XmlValidatorFactory .createValidator(resource, XmlValidatorFactory.SCHEMA_W3C_XML); } catch (IOException ex) { throw new CommonsXsdSchemaException(ex.getMessage(), ex); } }
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 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 LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { String s = JAXBDataBinding.mapSchemaLocation(systemId, baseURI, catalog); LOG.fine("validating: " + namespaceURI + " " + systemId + " " + baseURI + " " + s); if (s == null) { XmlSchema sc = schemaCollection.getSchemaByTargetNamespace(namespaceURI); if (sc != null) { StringWriter writer = new StringWriter(); sc.write(writer); InputSource src = new InputSource(new StringReader(writer.toString())); src.setSystemId(sc.getSourceURI()); return new LSInputSAXWrapper(src); } throw new ToolException("Schema not found for namespace: " + namespaceURI); } return new LSInputSAXWrapper(new InputSource(s)); } });
String baseURI = schema.getSourceURI(); outStream.write(baseURI.getBytes()); outStream.write(separator);
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 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); } } } } }
if (schema.getSourceURI() != null) { include.schema = resolveXmlSchema(schema.logicalTargetNamespace, include.schemaLocation, schema.getSourceURI(), validator); } else { include.schema = resolveXmlSchema(schema.logicalTargetNamespace,
if (schema.getSourceURI() != null) { include.schema = resolveXmlSchema(schema.logicalTargetNamespace, include.schemaLocation, schema.getSourceURI(), validator); } else { include.schema = resolveXmlSchema(schema.logicalTargetNamespace,