本文整理汇总了Java中org.apache.xerces.dom.DOMXSImplementationSourceImpl类的典型用法代码示例。如果您正苦于以下问题:Java DOMXSImplementationSourceImpl类的具体用法?Java DOMXSImplementationSourceImpl怎么用?Java DOMXSImplementationSourceImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DOMXSImplementationSourceImpl类属于org.apache.xerces.dom包,在下文中一共展示了DOMXSImplementationSourceImpl类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SchemaLoader
import org.apache.xerces.dom.DOMXSImplementationSourceImpl; //导入依赖的package包/类
/**
* Constructor to build a Schema instance around a given nodeName
*
* @param schemaFileURI a schema file URI.
* @param nodeName the local name of the target node.
* @throws Exception if there is an error loading the schema or if the root element count in the schema is less than
* one.
*/
public SchemaLoader(String schemaFileURI, String nodeName) throws Exception {
this.setSchemaFileURI(schemaFileURI);
targetNode = nodeName;
// get DOM Implementation using DOM Registry
System.setProperty(DOMImplementationRegistry.PROPERTY, DOMXSImplementationSourceImpl.class.getName());
impRegistry = DOMImplementationRegistry.newInstance();
XSImplementation impl = (XSImplementation) impRegistry.getDOMImplementation("XS-Loader");
XSLoader schemaLoader = impl.createXSLoader(null);
// schemaLoader.getConfig().setParameter("validate", Boolean.TRUE);
String[] soapenvSchemaPath = { schemaFileURI, this.getClass().getResource(SOAP_11_SCHEMA_PATH).toExternalForm() };
StringList schemaList = new StringListImpl(soapenvSchemaPath, 2);
xsModel = schemaLoader.loadURIList(schemaList);
this.referenceNodes = new SchemaHelper(xsModel);
if (nodeName != null && 0 < nodeName.trim().length()) {
nodeChoiceList = referenceNodes.getAncestors(nodeName);
}
}
示例2: XSParser
import org.apache.xerces.dom.DOMXSImplementationSourceImpl; //导入依赖的package包/类
public XSParser(LSResourceResolver entityResolver, DOMErrorHandler errorHandler){
System.setProperty(DOMImplementationRegistry.PROPERTY, DOMXSImplementationSourceImpl.class.getName());
DOMImplementationRegistry registry;
try{
registry = DOMImplementationRegistry.newInstance();
}catch(Exception ex){
throw new ImpossibleException(ex);
}
XSImplementationImpl xsImpl = (XSImplementationImpl)registry.getDOMImplementation("XS-Loader");
xsLoader = xsImpl.createXSLoader(null);
DOMConfiguration config = xsLoader.getConfig();
config.setParameter(Constants.DOM_VALIDATE, Boolean.TRUE);
if(entityResolver!=null)
config.setParameter(Constants.DOM_RESOURCE_RESOLVER, entityResolver);
if(errorHandler!=null)
config.setParameter(Constants.DOM_ERROR_HANDLER, errorHandler);
}
示例3: registerModel
import org.apache.xerces.dom.DOMXSImplementationSourceImpl; //导入依赖的package包/类
/**
* registers bunch of node path's specified in the XML schema (XSD)
*
* @param model String; schema in plain text
* @throws BagriException in case of any error
*/
@Override
public void registerModel(String model) throws BagriException {
XSImplementation impl = (XSImplementation) new DOMXSImplementationSourceImpl().getDOMImplementation("XS-Loader LS");
XSLoader schemaLoader = impl.createXSLoader(null);
LSInput lsi = ((DOMImplementationLS) impl).createLSInput();
lsi.setStringData(model);
XSModel schema = schemaLoader.load(lsi);
processModel(schema);
}
示例4: registerModels
import org.apache.xerces.dom.DOMXSImplementationSourceImpl; //导入依赖的package包/类
/**
* registers bunch of schemas located in the schemaUri folder
*
* @param modelsUri String; the folder containing schemas to register
* @throws BagriException in case of any error
*/
//@Override
public void registerModels(String modelsUri) throws BagriException {
XSImplementation impl = (XSImplementation) new DOMXSImplementationSourceImpl().getDOMImplementation("XS-Loader LS");
XSLoader schemaLoader = impl.createXSLoader(null);
java.nio.file.Path catalog = Paths.get(modelsUri);
List<String> files = new ArrayList<>();
processCatalog(catalog, files);
if (files.size() > 0) {
StringList schemas = impl.createStringList(files.toArray(new String[files.size()]));
XSModel schema = schemaLoader.loadURIList(schemas);
processModel(schema);
}
}