com.sun.org.apache.xerces.internal.util.DOMInputSource Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.util.DOMInputSource. 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: XSDHandler.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #2
Source File: XSDHandler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #3
Source File: XSDHandler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #4
Source File: XSDHandler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #5
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #6
Source File: XSDHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #7
Source File: XSDHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #8
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #9
Source File: XSDHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #10
Source File: XSDHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private Element resolveSchema(XMLInputSource schemaSource, XSDDescription desc,
        boolean mustResolve, Element referElement) {

    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #11
Source File: XSDHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
 * and if it was succefully resolved getting the schema Document.
 * @param desc
 * @param mustResolve
 * @param referElement
 * @return A schema Element or null.
 */
private Element resolveSchema(XSDDescription desc, boolean mustResolve,
                              Element referElement, boolean usePairs) {
    XMLInputSource schemaSource = null;
    try {
        Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap();
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #12
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
 * and if it was succefully resolved getting the schema Document.
 * @param desc
 * @param mustResolve
 * @param referElement
 * @return A schema Element or null.
 */
private Element resolveSchema(XSDDescription desc, boolean mustResolve,
                              Element referElement, boolean usePairs) {
    XMLInputSource schemaSource = null;
    try {
        Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap();
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #13
Source File: XSDHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
 * and if it was succefully resolved getting the schema Document.
 * @param desc
 * @param mustResolve
 * @param referElement
 * @return A schema Element or null.
 */
private Element resolveSchema(XSDDescription desc, boolean mustResolve,
                              Element referElement, boolean usePairs) {
    XMLInputSource schemaSource = null;
    try {
        Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap();
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #14
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
 * and if it was successfully resolved getting the schema Document.
 * @param desc
 * @param mustResolve
 * @param referElement
 * @return A schema Element or null.
 */
private Element resolveSchema(XSDDescription desc, boolean mustResolve,
                              Element referElement, boolean usePairs) {
    XMLInputSource schemaSource = null;
    try {
        Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap();
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #15
Source File: XSDHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
 * and if it was succefully resolved getting the schema Document.
 * @param desc
 * @param mustResolve
 * @param referElement
 * @return A schema Element or null.
 */
private Element resolveSchema(XSDDescription desc, boolean mustResolve,
                              Element referElement, boolean usePairs) {
    XMLInputSource schemaSource = null;
    try {
        Map pairs = usePairs ? fLocationPairs : EMPTY_TABLE;
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityResolver);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #16
Source File: XSDHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
 * and if it was succefully resolved getting the schema Document.
 * @param desc
 * @param mustResolve
 * @param referElement
 * @return A schema Element or null.
 */
private Element resolveSchema(XSDDescription desc, boolean mustResolve,
                              Element referElement, boolean usePairs) {
    XMLInputSource schemaSource = null;
    try {
        Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap();
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #17
Source File: XSDHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
 * and if it was succefully resolved getting the schema Document.
 * @param desc
 * @param mustResolve
 * @param referElement
 * @return A schema Element or null.
 */
private Element resolveSchema(XSDDescription desc, boolean mustResolve,
                              Element referElement, boolean usePairs) {
    XMLInputSource schemaSource = null;
    try {
        Map pairs = usePairs ? fLocationPairs : EMPTY_TABLE;
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityResolver);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #18
Source File: XSDHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
 * and if it was succefully resolved getting the schema Document.
 * @param desc
 * @param mustResolve
 * @param referElement
 * @return A schema Element or null.
 */
private Element resolveSchema(XSDDescription desc, boolean mustResolve,
                              Element referElement, boolean usePairs) {
    XMLInputSource schemaSource = null;
    try {
        Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap();
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #19
Source File: XSDHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
 * and if it was succefully resolved getting the schema Document.
 * @param desc
 * @param mustResolve
 * @param referElement
 * @return A schema Element or null.
 */
private Element resolveSchema(XSDDescription desc, boolean mustResolve,
                              Element referElement, boolean usePairs) {
    XMLInputSource schemaSource = null;
    try {
        Map pairs = usePairs ? fLocationPairs : EMPTY_TABLE;
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityResolver);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}
 
Example #20
Source File: XSDHandler.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
 * and if it was succefully resolved getting the schema Document.
 * @param desc
 * @param mustResolve
 * @param referElement
 * @return A schema Element or null.
 */
private Element resolveSchema(XSDDescription desc, boolean mustResolve,
                              Element referElement, boolean usePairs) {
    XMLInputSource schemaSource = null;
    try {
        Map<String, XMLSchemaLoader.LocationArray> pairs = usePairs ? fLocationPairs : Collections.emptyMap();
        schemaSource = XMLSchemaLoader.resolveDocument(desc, pairs, fEntityManager);
    }
    catch (IOException ex) {
        if (mustResolve) {
            reportSchemaError("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
        else {
            reportSchemaWarning("schema_reference.4",
                    new Object[]{desc.getLocationHints()[0]},
                    referElement);
        }
    }
    if (schemaSource instanceof DOMInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (DOMInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // DOMInputSource
    else if (schemaSource instanceof SAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (SAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // SAXInputSource
    else if (schemaSource instanceof StAXInputSource) {
        return getSchemaDocument(desc.getTargetNamespace(), (StAXInputSource) schemaSource, mustResolve, desc.getContextType(), referElement);
    } // StAXInputSource
    else if (schemaSource instanceof XSInputSource) {
        return getSchemaDocument((XSInputSource) schemaSource, desc);
    } // XSInputSource
    return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
}