Java Code Examples for com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver#resolveEntity()
The following examples show how to use
com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver#resolveEntity() .
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: XMLSchemaLoader.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a map (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the map whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map<String, LocationArray> locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example 2
Source File: XMLSchemaLoader.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a map (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the map whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map<String, LocationArray> locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example 3
Source File: XMLSchemaLoader.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a hashtable (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the hashtable whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = (LocationArray)locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example 4
Source File: XMLSchemaLoader.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a map (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the map whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map<String, LocationArray> locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example 5
Source File: XMLSchemaLoader.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a map (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the map whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map<String, LocationArray> locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example 6
Source File: XMLSchemaLoader.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a map (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the map whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map<String, LocationArray> locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example 7
Source File: XMLSchemaLoader.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a map (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the map whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return the XMLInputSource * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map<String, LocationArray> locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example 8
Source File: XMLSchemaLoader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a map (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the map whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return the XMLInputSource * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map<String, LocationArray> locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example 9
Source File: XMLSchemaLoader.java From hottub with GNU General Public License v2.0 | 5 votes |
/** This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a map (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the map whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map<String, LocationArray> locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example 10
Source File: XMLSchemaLoader.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a hashtable (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the hashtable whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = (LocationArray)locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example 11
Source File: XMLSchemaLoader.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a hashtable (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the hashtable whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = (LocationArray)locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }