當前位置: 首頁>>代碼示例>>Java>>正文


Java DOMXSImplementationSourceImpl類代碼示例

本文整理匯總了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);
   }
}
 
開發者ID:mqsysadmin,項目名稱:dpdirect,代碼行數:26,代碼來源:SchemaLoader.java

示例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);
}
 
開發者ID:santhosh-tekuri,項目名稱:jlibs,代碼行數:21,代碼來源:XSParser.java

示例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);
}
 
開發者ID:dsukhoroslov,項目名稱:bagri,代碼行數:17,代碼來源:XmlModeler.java

示例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);
	}
}
 
開發者ID:dsukhoroslov,項目名稱:bagri,代碼行數:21,代碼來源:XmlModeler.java


注:本文中的org.apache.xerces.dom.DOMXSImplementationSourceImpl類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。