use of org.apache.cxf.wsdl11.ResourceManagerWSDLLocator in project cxf by apache.
the class WSDLGetUtils method readXSDDocument.
/**
* Read the schema file and return as a Document object.
*
* @param bus CXF's hub for access to internal constructs
* @param xsd name of xsd file to be read
* @param smp a map of known xsd SchemaReference objects
* @param base the request URL
* @return Document
* @throws XMLStreamException
*/
protected Document readXSDDocument(Bus bus, String xsd, Map<String, SchemaReference> smp, String base) throws XMLStreamException {
Document doc = null;
SchemaReference si = lookupSchemaReference(bus, xsd, smp, base);
String uri = si.getReferencedSchema().getDocumentBaseURI();
uri = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus), uri, si.getReferencedSchema().getDocumentBaseURI());
if (uri == null) {
uri = si.getReferencedSchema().getDocumentBaseURI();
}
ResourceManagerWSDLLocator rml = new ResourceManagerWSDLLocator(uri, bus);
InputSource src = rml.getBaseInputSource();
if (src.getByteStream() != null || src.getCharacterStream() != null) {
doc = StaxUtils.read(src);
} else {
// last resort lets try for the referenced schema itself.
// its not thread safe if we use the same document
doc = StaxUtils.read(new DOMSource(si.getReferencedSchema().getElement().getOwnerDocument()));
}
return doc;
}
Aggregations