com.sun.org.apache.xerces.internal.xs.XSModel Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.xs.XSModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XSGrammarPool.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #2
Source File: XSGrammarPool.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #3
Source File: XSGrammarPool.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
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);
}
 
Example #4
Source File: SchemaGrammar.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
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);
}
 
Example #5
Source File: SchemaGrammar.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #6
Source File: XSGrammarPool.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #7
Source File: SchemaGrammar.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #8
Source File: XSGrammarPool.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #9
Source File: SchemaGrammar.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #10
Source File: SchemaGrammar.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #11
Source File: XSLoaderImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 *  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;
    }
}
 
Example #12
Source File: XSLoaderImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *  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;
    }
}
 
Example #13
Source File: XSLoaderImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
    }
}
 
Example #14
Source File: XSLoaderImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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;
    }
}
 
Example #15
Source File: XMLSchemaLoader.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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);
}
 
Example #16
Source File: XMLSchemaLoader.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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;
    }
}
 
Example #17
Source File: XMLSchemaLoader.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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);
}
 
Example #18
Source File: XMLSchemaLoader.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public XSModel load(LSInput is) {
    try {
        Grammar g = loadGrammar(dom2xmlInputSource(is));
        return ((XSGrammar) g).toXSModel();
    } catch (Exception e) {
        reportDOMFatalError(e);
        return null;
    }
}
 
Example #19
Source File: ElementPSVImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * [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;
}
 
Example #20
Source File: XSLoaderImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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;
    }
}
 
Example #21
Source File: XSLoaderImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
    }
}
 
Example #22
Source File: XMLSchemaLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #23
Source File: XMLSchemaLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
    }
}
 
Example #24
Source File: XMLSchemaLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #25
Source File: XMLSchemaLoader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public XSModel load(LSInput is) {
    try {
        Grammar g = loadGrammar(dom2xmlInputSource(is));
        return ((XSGrammar) g).toXSModel();
    } catch (Exception e) {
        reportDOMFatalError(e);
        return null;
    }
}
 
Example #26
Source File: XMLSchemaLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public XSModel load(LSInput is) {
    try {
        Grammar g = loadGrammar(dom2xmlInputSource(is));
        return ((XSGrammar) g).toXSModel();
    } catch (Exception e) {
        reportDOMFatalError(e);
        return null;
    }
}
 
Example #27
Source File: XSLoaderImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 *  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;
    }
}
 
Example #28
Source File: XMLSchemaLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #29
Source File: XMLSchemaLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
    }
}
 
Example #30
Source File: XSLoaderImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *  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;
    }
}