当前位置: 首页>>代码示例>>Java>>正文


Java XSModel类代码示例

本文整理汇总了Java中mf.org.apache.xerces.xs.XSModel的典型用法代码示例。如果您正苦于以下问题:Java XSModel类的具体用法?Java XSModel怎么用?Java XSModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XSModel类属于mf.org.apache.xerces.xs包,在下文中一共展示了XSModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toXSModel

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
public XSModel toXSModel(XSGrammar[] grammars) {
    if (grammars == null || grammars.length == 0)
        return toXSModel();

    int len = grammars.length;
    boolean hasSelf = false;
    for (int i = 0; i < len; i++) {
        if (grammars[i] == this) {
            hasSelf = true;
            break;
        }
    }

    SchemaGrammar[] gs = new SchemaGrammar[hasSelf ? len : len+1];
    for (int i = 0; i < len; i++)
        gs[i] = (SchemaGrammar)grammars[i];
    if (!hasSelf)
        gs[len] = this;
    return new XSModelImpl(gs);
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:21,代码来源:SchemaGrammar.java

示例2: toXSModel

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
public XSModel toXSModel(short schemaVersion) {
    ArrayList list = new ArrayList();
    for (int i = 0; i < fGrammars.length; i++) {
        for (Entry entry = fGrammars[i] ; entry != null ; entry = entry.next) {
            if (entry.desc.getGrammarType().equals(XMLGrammarDescription.XML_SCHEMA)) {
                list.add(entry.grammar);
            }
        }
    }
    int size = list.size();
    if (size == 0) {
        return toXSModel(new SchemaGrammar[0], schemaVersion);
    }
    SchemaGrammar[] gs = (SchemaGrammar[])list.toArray(new SchemaGrammar[size]);
    return toXSModel(gs, schemaVersion);
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:17,代码来源:XSGrammarPool.java

示例3: load

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
public XSModel load(LSInput is) {
    try {
        Grammar g = loadGrammar(dom2xmlInputSource(is));
        return ((XSGrammar) g).toXSModel();
    } catch (Exception e) {
        reportDOMFatalError(e);
        return null;
    }
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:10,代码来源:XMLSchemaLoader.java

示例4: loadInputList

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
public XSModel loadInputList(LSInputList is) {
    int length = is.getLength();
    SchemaGrammar[] gs = new SchemaGrammar[length];
    for (int i = 0; i < length; i++) {
        try {
            gs[i] = (SchemaGrammar) loadGrammar(dom2xmlInputSource(is.item(i)));
        } catch (Exception e) {
            reportDOMFatalError(e);
            return null;
        }
    }
    return new XSModelImpl(gs);
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:14,代码来源:XMLSchemaLoader.java

示例5: loadURI

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
public XSModel loadURI(String uri) {
    try {
        Grammar g = loadGrammar(new XMLInputSource(null, uri, null));
        return ((XSGrammar)g).toXSModel();
    }
    catch (Exception e){
        reportDOMFatalError(e);
        return null;
    }
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:11,代码来源:XMLSchemaLoader.java

示例6: loadURIList

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
public XSModel loadURIList(StringList uriList) {
    int length = uriList.getLength();
    SchemaGrammar[] gs = new SchemaGrammar[length];
    for (int i = 0; i < length; i++) {
        try {
            gs[i] =
                (SchemaGrammar) loadGrammar(new XMLInputSource(null, uriList.item(i), null));
        } catch (Exception e) {
            reportDOMFatalError(e);
            return null;
        }
    }
    return new XSModelImpl(gs);
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:15,代码来源:XMLSchemaLoader.java

示例7: loadURIList

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
/**
 * Parses the content of XML Schema documents specified as the list of URI 
 * references. If the URI contains a fragment identifier, the behavior 
 * is not defined by this specification. 
 * @param uriList The list of URI locations.
 * @return An XSModel representing the schema documents.
 */
public XSModel loadURIList(StringList uriList) {
    int length = uriList.getLength();
    try {
        fGrammarPool.clear();
        for (int i = 0; i < length; ++i) {
            fSchemaLoader.loadGrammar(new XMLInputSource(null, uriList.item(i), null));
        }
        return fGrammarPool.toXSModel();
    } 
    catch (Exception e) {
        fSchemaLoader.reportDOMFatalError(e);
        return null;
    }
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:22,代码来源:XSLoaderImpl.java

示例8: loadInputList

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
/**
 *  Parses the content of XML Schema documents specified as a list of 
 * <code>LSInput</code>s. 
 * @param is  The list of <code>LSInput</code>s from which the XML 
 *   Schema documents are to be read. 
 * @return An XSModel representing the schema documents.
 */
public XSModel loadInputList(LSInputList is) {
    final int length = is.getLength();
    try {
        fGrammarPool.clear();
        for (int i = 0; i < length; ++i) {
            fSchemaLoader.loadGrammar(fSchemaLoader.dom2xmlInputSource(is.item(i)));
        }
        return fGrammarPool.toXSModel();
    } 
    catch (Exception e) {
        fSchemaLoader.reportDOMFatalError(e);
        return null;
    }
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:22,代码来源:XSLoaderImpl.java

示例9: loadURI

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
/**
 * Parse an XML Schema document from a location identified by a URI 
 * reference. If the URI contains a fragment identifier, the behavior is 
 * not defined by this specification. 
 * @param uri The location of the XML Schema document to be read.
 * @return An XSModel representing this schema.
 */
public XSModel loadURI(String uri) {
    try {
        fGrammarPool.clear();
        return ((XSGrammar) fSchemaLoader.loadGrammar(new XMLInputSource(null, uri, null))).toXSModel();
    }
    catch (Exception e){
        fSchemaLoader.reportDOMFatalError(e);
        return null;
    }
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:18,代码来源:XSLoaderImpl.java

示例10: load

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
/**
 *  Parse an XML Schema document from a resource identified by a 
 * <code>LSInput</code> . 
 * @param is  The <code>LSInput</code> from which the source 
 *   document is to be read. 
 * @return An XSModel representing this schema.
 */
public XSModel load(LSInput is) {
    try {
        fGrammarPool.clear();
        return ((XSGrammar) fSchemaLoader.loadGrammar(fSchemaLoader.dom2xmlInputSource(is))).toXSModel();
    } 
    catch (Exception e) {
        fSchemaLoader.reportDOMFatalError(e);
        return null;
    }
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:18,代码来源:XSLoaderImpl.java

示例11: getSchemaInformation

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
/**
 * [schema information]
 * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_information">XML Schema Part 1: Structures [schema information]</a>
 * @return The schema information property if it's the validation root,
 *         null otherwise.
 */
public synchronized XSModel getSchemaInformation() {
    if (fSchemaInformation == null && fGrammars != null) {
        fSchemaInformation = new XSModelImpl(fGrammars);
    }
    return fSchemaInformation;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:13,代码来源:ElementPSVImpl.java

示例12: readSchemaInternal

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
private static XSModel readSchemaInternal(String schemaResource, String schemaText) throws IllegalAccessException, InstantiationException, ClassNotFoundException,
        ConfigurationException, URISyntaxException
{
    LSInputImpl input = null;
    String baseURI = null;
    if (schemaResource != null) {
        URL url = ResourceLoader.resolveClassPathOrURLResource("schema", schemaResource);
        baseURI = url.toURI().toString();
    }
    else {
        input = new LSInputImpl(schemaText);
    }

    // Uses Xerxes internal classes
    DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
    registry.addSource(new DOMXSImplementationSourceImpl());
    Object xsImplementation = registry.getDOMImplementation("XS-Loader");
    if (xsImplementation == null) {
        throw new ConfigurationException("Failed to retrieve XS-Loader implementation from registry obtained via DOMImplementationRegistry.newInstance, please check that registry.getDOMImplementation(\"XS-Loader\") returns an instance");
    }
    if (!JavaClassHelper.isImplementsInterface(xsImplementation.getClass(), XSImplementation.class)) {
        String message = "The XS-Loader instance returned by the DOM registry class '" + xsImplementation.getClass().getName() + "' does not implement the interface '" + XSImplementation.class.getName() + "'; If you have a another Xerces distribution in your classpath please ensure the classpath order loads the JRE Xerces distribution or set the DOMImplementationRegistry.PROPERTY system property";
        throw new ConfigurationException(message);
    }
    XSImplementation impl =(XSImplementation) xsImplementation; 
    XSLoader schemaLoader = impl.createXSLoader(null);
    XSModel xsModel;
    if (input != null) {
        xsModel = schemaLoader.load((mf.org.w3c.dom.ls.LSInput) input);
    }
    else {
        xsModel = schemaLoader.loadURI(baseURI);
    }

    if (xsModel == null)
    {
        throw new ConfigurationException("Failed to read schema via URL '" + schemaResource + '\'');
    }

    return xsModel;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:42,代码来源:XSDSchemaMapper.java

示例13: map

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
private static SchemaModel map(XSModel xsModel, int maxRecusiveDepth)
{
    // get namespaces
    StringList namespaces = xsModel.getNamespaces();
    List<String> namesspaceList = new ArrayList<String>();
    for (int i = 0; i < namespaces.getLength(); i++)
    {
        namesspaceList.add(namespaces.item(i));
    }

    // get top-level complex elements
    XSNamedMap elements = xsModel.getComponents(XSConstants.ELEMENT_DECLARATION);
    List<SchemaElementComplex> components = new ArrayList<SchemaElementComplex>();

    for (int i = 0; i < elements.getLength(); i++)
    {
        XSObject object = elements.item(i);
        if (!(object instanceof XSElementDeclaration))
        {
            continue;
        }

        XSElementDeclaration decl = (XSElementDeclaration) elements.item(i);
        if (!isComplexTypeCategory(decl.getTypeDefinition().getTypeCategory()))
        {
            continue;
        }            

        XSComplexTypeDefinition complexActualElement = (XSComplexTypeDefinition) decl.getTypeDefinition();
        String name = object.getName();
        String namespace = object.getNamespace();
        Stack<NamespaceNamePair> nameNamespaceStack = new Stack<NamespaceNamePair>();
        NamespaceNamePair nameNamespace = new NamespaceNamePair(namespace, name);
        nameNamespaceStack.add(nameNamespace);

        if (log.isDebugEnabled())
        {
            log.debug("Processing component " + namespace + " " + name);
        }

        SchemaElementComplex complexElement = process(name, namespace, complexActualElement, false, nameNamespaceStack, maxRecusiveDepth);

        if (log.isDebugEnabled())
        {
            log.debug("Adding component " + namespace + " " + name);
        }
        components.add(complexElement);
    }

    return new SchemaModel(components, namesspaceList);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:52,代码来源:XSDSchemaMapper.java

示例14: toXSModel

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
/**
 * Return an <code>XSModel</code> that represents components in this schema
 * grammar and any schema grammars that are imported by this grammar
 * directly or indirectly.
 * 
 * @return  an <code>XSModel</code> representing this schema grammar
 */
public XSModel toXSModel();
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:9,代码来源:XSGrammar.java

示例15: getSchemaInformation

import mf.org.apache.xerces.xs.XSModel; //导入依赖的package包/类
/**
 * [schema information]
 * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_information">XML Schema Part 1: Structures [schema information]</a>
 * @return The schema information property if it's the validation root,
 *         null otherwise.
 */
public XSModel getSchemaInformation() {
    return fSchemaInformation;
}
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:10,代码来源:PSVIElementNSImpl.java


注:本文中的mf.org.apache.xerces.xs.XSModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。