Java Code Examples for com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier#getLiteralSystemId()
The following examples show how to use
com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier#getLiteralSystemId() .
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: AbstractSAXParser.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * A notation declaration * * @param name The name of the notation. * @param identifier An object containing all location information * pertinent to this notation. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void notationDecl(String name, XMLResourceIdentifier identifier, Augmentations augs) throws XNIException { try { // SAX1 and SAX2 if (fDTDHandler != null) { String publicId = identifier.getPublicId(); String systemId = fResolveDTDURIs ? identifier.getExpandedSystemId() : identifier.getLiteralSystemId(); fDTDHandler.notationDecl(name, publicId, systemId); } } catch (SAXException e) { throw new XNIException(e); } }
Example 2
Source File: AbstractSAXParser.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * An external entity declaration. * * @param name The name of the entity. Parameter entity names start * with '%', whereas the name of a general entity is just * the entity name. * @param identifier An object containing all location information * pertinent to this entity. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void externalEntityDecl(String name, XMLResourceIdentifier identifier, Augmentations augs) throws XNIException { try { // SAX2 extension if (fDeclHandler != null) { String publicId = identifier.getPublicId(); String systemId = fResolveDTDURIs ? identifier.getExpandedSystemId() : identifier.getLiteralSystemId(); fDeclHandler.externalEntityDecl(name, publicId, systemId); } } catch (SAXException e) { throw new XNIException(e); } }
Example 3
Source File: AbstractSAXParser.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * A notation declaration * * @param name The name of the notation. * @param identifier An object containing all location information * pertinent to this notation. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void notationDecl(String name, XMLResourceIdentifier identifier, Augmentations augs) throws XNIException { try { // SAX1 and SAX2 if (fDTDHandler != null) { String publicId = identifier.getPublicId(); String systemId = fResolveDTDURIs ? identifier.getExpandedSystemId() : identifier.getLiteralSystemId(); fDTDHandler.notationDecl(name, publicId, systemId); } } catch (SAXException e) { throw new XNIException(e); } }
Example 4
Source File: AbstractSAXParser.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * An external entity declaration. * * @param name The name of the entity. Parameter entity names start * with '%', whereas the name of a general entity is just * the entity name. * @param identifier An object containing all location information * pertinent to this entity. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void externalEntityDecl(String name, XMLResourceIdentifier identifier, Augmentations augs) throws XNIException { try { // SAX2 extension if (fDeclHandler != null) { String publicId = identifier.getPublicId(); String systemId = fResolveDTDURIs ? identifier.getExpandedSystemId() : identifier.getLiteralSystemId(); fDeclHandler.externalEntityDecl(name, publicId, systemId); } } catch (SAXException e) { throw new XNIException(e); } }
Example 5
Source File: AbstractSAXParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * An unparsed entity declaration. * * @param name The name of the entity. * @param identifier An object containing all location information * pertinent to this entity. * @param notation The name of the notation. * * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void unparsedEntityDecl(String name, XMLResourceIdentifier identifier, String notation, Augmentations augs) throws XNIException { try { // SAX2 extension if (fDTDHandler != null) { String publicId = identifier.getPublicId(); String systemId = fResolveDTDURIs ? identifier.getExpandedSystemId() : identifier.getLiteralSystemId(); fDTDHandler.unparsedEntityDecl(name, publicId, systemId, notation); } } catch (SAXException e) { throw new XNIException(e); } }
Example 6
Source File: AbstractSAXParser.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * A notation declaration * * @param name The name of the notation. * @param identifier An object containing all location information * pertinent to this notation. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void notationDecl(String name, XMLResourceIdentifier identifier, Augmentations augs) throws XNIException { try { // SAX1 and SAX2 if (fDTDHandler != null) { String publicId = identifier.getPublicId(); String systemId = fResolveDTDURIs ? identifier.getExpandedSystemId() : identifier.getLiteralSystemId(); fDTDHandler.notationDecl(name, publicId, systemId); } } catch (SAXException e) { throw new XNIException(e); } }
Example 7
Source File: AbstractSAXParser.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * An unparsed entity declaration. * * @param name The name of the entity. * @param identifier An object containing all location information * pertinent to this entity. * @param notation The name of the notation. * * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void unparsedEntityDecl(String name, XMLResourceIdentifier identifier, String notation, Augmentations augs) throws XNIException { try { // SAX2 extension if (fDTDHandler != null) { String publicId = identifier.getPublicId(); String systemId = fResolveDTDURIs ? identifier.getExpandedSystemId() : identifier.getLiteralSystemId(); fDTDHandler.unparsedEntityDecl(name, publicId, systemId, notation); } } catch (SAXException e) { throw new XNIException(e); } }
Example 8
Source File: AbstractSAXParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * A notation declaration * * @param name The name of the notation. * @param identifier An object containing all location information * pertinent to this notation. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void notationDecl(String name, XMLResourceIdentifier identifier, Augmentations augs) throws XNIException { try { // SAX1 and SAX2 if (fDTDHandler != null) { String publicId = identifier.getPublicId(); String systemId = fResolveDTDURIs ? identifier.getExpandedSystemId() : identifier.getLiteralSystemId(); fDTDHandler.notationDecl(name, publicId, systemId); } } catch (SAXException e) { throw new XNIException(e); } }
Example 9
Source File: AbstractSAXParser.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * An unparsed entity declaration. * * @param name The name of the entity. * @param identifier An object containing all location information * pertinent to this entity. * @param notation The name of the notation. * * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void unparsedEntityDecl(String name, XMLResourceIdentifier identifier, String notation, Augmentations augs) throws XNIException { try { // SAX2 extension if (fDTDHandler != null) { String publicId = identifier.getPublicId(); String systemId = fResolveDTDURIs ? identifier.getExpandedSystemId() : identifier.getLiteralSystemId(); fDTDHandler.unparsedEntityDecl(name, publicId, systemId, notation); } } catch (SAXException e) { throw new XNIException(e); } }
Example 10
Source File: XIncludeHandler.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Caches a notation. * @param name the name of the notation * @param identifier the location of the notation * @param augmentations any Augmentations that were on the original notation declaration */ protected void addNotation( String name, XMLResourceIdentifier identifier, Augmentations augmentations) { Notation not = new Notation(); not.name = name; not.systemId = identifier.getLiteralSystemId(); not.publicId = identifier.getPublicId(); not.baseURI = identifier.getBaseSystemId(); not.expandedSystemId = identifier.getExpandedSystemId(); not.augmentations = augmentations; fNotations.add(not); }
Example 11
Source File: XMLCatalogResolver.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * <p>Resolves an identifier using the catalog. This method interprets that * the namespace of the identifier corresponds to uri entries in the catalog. * Where both a namespace and an external identifier exist, the namespace * takes precedence.</p> * * @param resourceIdentifier the identifier to resolve * * @throws XNIException thrown on general error * @throws IOException thrown if some i/o error occurs */ public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier) throws IOException, XNIException { String resolvedId = null; // The namespace is useful for resolving namespace aware // grammars such as XML schema. Let it take precedence over // the external identifier if one exists. String namespace = resourceIdentifier.getNamespace(); if (namespace != null) { resolvedId = resolveURI(namespace); } // Resolve against an external identifier if one exists. This // is useful for resolving DTD external subsets and other // external entities. For XML schemas if there was no namespace // mapping we might be able to resolve a system identifier // specified as a location hint. if (resolvedId == null) { String publicId = resourceIdentifier.getPublicId(); String systemId = getUseLiteralSystemId() ? resourceIdentifier.getLiteralSystemId() : resourceIdentifier.getExpandedSystemId(); if (publicId != null && systemId != null) { resolvedId = resolvePublic(publicId, systemId); } else if (systemId != null) { resolvedId = resolveSystem(systemId); } } return resolvedId; }
Example 12
Source File: XIncludeHandler.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Caches a notation. * @param name the name of the notation * @param identifier the location of the notation * @param augmentations any Augmentations that were on the original notation declaration */ protected void addNotation( String name, XMLResourceIdentifier identifier, Augmentations augmentations) { Notation not = new Notation(); not.name = name; not.systemId = identifier.getLiteralSystemId(); not.publicId = identifier.getPublicId(); not.baseURI = identifier.getBaseSystemId(); not.expandedSystemId = identifier.getExpandedSystemId(); not.augmentations = augmentations; fNotations.add(not); }
Example 13
Source File: XMLCatalogResolver.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * <p>Resolves an identifier using the catalog. This method interprets that * the namespace of the identifier corresponds to uri entries in the catalog. * Where both a namespace and an external identifier exist, the namespace * takes precedence.</p> * * @param resourceIdentifier the identifier to resolve * * @throws XNIException thrown on general error * @throws IOException thrown if some i/o error occurs */ public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier) throws IOException, XNIException { String resolvedId = null; // The namespace is useful for resolving namespace aware // grammars such as XML schema. Let it take precedence over // the external identifier if one exists. String namespace = resourceIdentifier.getNamespace(); if (namespace != null) { resolvedId = resolveURI(namespace); } // Resolve against an external identifier if one exists. This // is useful for resolving DTD external subsets and other // external entities. For XML schemas if there was no namespace // mapping we might be able to resolve a system identifier // specified as a location hint. if (resolvedId == null) { String publicId = resourceIdentifier.getPublicId(); String systemId = getUseLiteralSystemId() ? resourceIdentifier.getLiteralSystemId() : resourceIdentifier.getExpandedSystemId(); if (publicId != null && systemId != null) { resolvedId = resolvePublic(publicId, systemId); } else if (systemId != null) { resolvedId = resolveSystem(systemId); } } return resolvedId; }
Example 14
Source File: XIncludeHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Caches a notation. * @param name the name of the notation * @param identifier the location of the notation * @param augmentations any Augmentations that were on the original notation declaration */ protected void addNotation( String name, XMLResourceIdentifier identifier, Augmentations augmentations) { Notation not = new Notation(); not.name = name; not.systemId = identifier.getLiteralSystemId(); not.publicId = identifier.getPublicId(); not.baseURI = identifier.getBaseSystemId(); not.expandedSystemId = identifier.getExpandedSystemId(); not.augmentations = augmentations; fNotations.add(not); }
Example 15
Source File: EntityResolver2Wrapper.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved * * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { if (fEntityResolver != null) { String pubId = resourceIdentifier.getPublicId(); String sysId = resourceIdentifier.getLiteralSystemId(); String baseURI = resourceIdentifier.getBaseSystemId(); String name = null; if (resourceIdentifier instanceof XMLDTDDescription) { name = "[dtd]"; } else if (resourceIdentifier instanceof XMLEntityDescription) { name = ((XMLEntityDescription) resourceIdentifier).getEntityName(); } // When both pubId and sysId are null, the user's entity resolver // can do nothing about it. We'd better not bother calling it. // This happens when the resourceIdentifier is a GrammarDescription, // which describes a schema grammar of some namespace, but without // any schema location hint. -Sg if (pubId == null && sysId == null) { return null; } // Resolve using EntityResolver2 try { InputSource inputSource = fEntityResolver.resolveEntity(name, pubId, baseURI, sysId); return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null; } // error resolving entity catch (SAXException e) { Exception ex = e.getException(); if (ex == null) { ex = e; } throw new XNIException(ex); } } // unable to resolve entity return null; }
Example 16
Source File: EntityResolver2Wrapper.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved * * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { if (fEntityResolver != null) { String pubId = resourceIdentifier.getPublicId(); String sysId = resourceIdentifier.getLiteralSystemId(); String baseURI = resourceIdentifier.getBaseSystemId(); String name = null; if (resourceIdentifier instanceof XMLDTDDescription) { name = "[dtd]"; } else if (resourceIdentifier instanceof XMLEntityDescription) { name = ((XMLEntityDescription) resourceIdentifier).getEntityName(); } // When both pubId and sysId are null, the user's entity resolver // can do nothing about it. We'd better not bother calling it. // This happens when the resourceIdentifier is a GrammarDescription, // which describes a schema grammar of some namespace, but without // any schema location hint. -Sg if (pubId == null && sysId == null) { return null; } // Resolve using EntityResolver2 try { InputSource inputSource = fEntityResolver.resolveEntity(name, pubId, baseURI, sysId); return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null; } // error resolving entity catch (SAXException e) { Exception ex = e.getException(); if (ex == null) { ex = e; } throw new XNIException(ex); } } // unable to resolve entity return null; }
Example 17
Source File: AbstractDOMParser.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * A notation declaration * * @param name The name of the notation. * @param identifier An object containing all location information * pertinent to this notation. * @param augs Additional information that may include infoset * augmentations. * * @throws XNIException Thrown by handler to signal an error. */ public void notationDecl (String name, XMLResourceIdentifier identifier, Augmentations augs) throws XNIException { // internal subset string String publicId = identifier.getPublicId (); String literalSystemId = identifier.getLiteralSystemId (); if (fInternalSubset != null && !fInDTDExternalSubset) { fInternalSubset.append ("<!NOTATION "); fInternalSubset.append (name); if (publicId != null) { fInternalSubset.append (" PUBLIC '"); fInternalSubset.append (publicId); if (literalSystemId != null) { fInternalSubset.append ("' '"); fInternalSubset.append (literalSystemId); } } else { fInternalSubset.append (" SYSTEM '"); fInternalSubset.append (literalSystemId); } fInternalSubset.append ("'>\n"); } // NOTE: We only know how to create these nodes for the Xerces // DOM implementation because DOM Level 2 does not specify // that functionality. -Ac // create full node if (fDocumentImpl !=null && fDocumentType != null) { NamedNodeMap notations = fDocumentType.getNotations (); if (notations.getNamedItem (name) == null) { NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name); notation.setPublicId (publicId); notation.setSystemId (literalSystemId); notation.setBaseURI (identifier.getBaseSystemId ()); notations.setNamedItem (notation); } } // create deferred node if (fDocumentTypeIndex != -1) { boolean found = false; int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false); while (nodeIndex != -1) { short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false); if (nodeType == Node.NOTATION_NODE) { String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false); if (nodeName.equals (name)) { found = true; break; } } nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false); } if (!found) { int notationIndex = fDeferredDocumentImpl.createDeferredNotation ( name, publicId, literalSystemId, identifier.getBaseSystemId ()); fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex); } } }
Example 18
Source File: EntityResolver2Wrapper.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier contains the physical co-ordinates of the resource to be resolved * * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { if (fEntityResolver != null) { String pubId = resourceIdentifier.getPublicId(); String sysId = resourceIdentifier.getLiteralSystemId(); String baseURI = resourceIdentifier.getBaseSystemId(); String name = null; if (resourceIdentifier instanceof XMLDTDDescription) { name = "[dtd]"; } else if (resourceIdentifier instanceof XMLEntityDescription) { name = ((XMLEntityDescription) resourceIdentifier).getEntityName(); } // When both pubId and sysId are null, the user's entity resolver // can do nothing about it. We'd better not bother calling it. // This happens when the resourceIdentifier is a GrammarDescription, // which describes a schema grammar of some namespace, but without // any schema location hint. -Sg if (pubId == null && sysId == null) { return null; } // Resolve using EntityResolver2 try { InputSource inputSource = fEntityResolver.resolveEntity(name, pubId, baseURI, sysId); return (inputSource != null) ? createXMLInputSource(inputSource, baseURI) : null; } // error resolving entity catch (SAXException e) { Exception ex = e.getException(); if (ex == null) { ex = e; } throw new XNIException(ex); } } // unable to resolve entity return null; }
Example 19
Source File: XMLEntityManager.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Resolves the specified public and system identifiers. This * method first attempts to resolve the entity based on the * EntityResolver registered by the application. If no entity * resolver is registered or if the registered entity handler * is unable to resolve the entity, then default entity * resolution will occur. * * @param publicId The public identifier of the entity. * @param systemId The system identifier of the entity. * @param baseSystemId The base system identifier of the entity. * This is the system identifier of the current * entity and is used to expand the system * identifier when the system identifier is a * relative URI. * * @return Returns an input source that wraps the resolved entity. * This method will never return null. * * @throws IOException Thrown on i/o error. * @throws XNIException Thrown by entity resolver to signal an error. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws IOException, XNIException { if(resourceIdentifier == null ) return null; String publicId = resourceIdentifier.getPublicId(); String literalSystemId = resourceIdentifier.getLiteralSystemId(); String baseSystemId = resourceIdentifier.getBaseSystemId(); String expandedSystemId = resourceIdentifier.getExpandedSystemId(); String namespace = resourceIdentifier.getNamespace(); // if no base systemId given, assume that it's relative // to the systemId of the current scanned entity // Sometimes the system id is not (properly) expanded. // We need to expand the system id if: // a. the expanded one was null; or // b. the base system id was null, but becomes non-null from the current entity. boolean needExpand = (expandedSystemId == null); // REVISIT: why would the baseSystemId ever be null? if we // didn't have to make this check we wouldn't have to reuse the // fXMLResourceIdentifier object... if (baseSystemId == null && fCurrentEntity != null && fCurrentEntity.entityLocation != null) { baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId(); if (baseSystemId != null) needExpand = true; } if (needExpand) expandedSystemId = expandSystemId(literalSystemId, baseSystemId,false); // give the entity resolver a chance XMLInputSource xmlInputSource = null; if (fEntityResolver != null) { resourceIdentifier.setBaseSystemId(baseSystemId); resourceIdentifier.setExpandedSystemId(expandedSystemId); xmlInputSource = fEntityResolver.resolveEntity(resourceIdentifier); } // do default resolution // REVISIT: what's the correct behavior if the user provided an entity // resolver (fEntityResolver != null), but resolveEntity doesn't return // an input source (xmlInputSource == null)? // do we do default resolution, or do we just return null? -SG if (xmlInputSource == null) { // REVISIT: when systemId is null, I think we should return null. // is this the right solution? -SG //if (systemId != null) xmlInputSource = new XMLInputSource(publicId, literalSystemId, baseSystemId); } if (DEBUG_RESOLVER) { System.err.println("XMLEntityManager.resolveEntity(" + publicId + ")"); System.err.println(" = " + xmlInputSource); } return xmlInputSource; }
Example 20
Source File: XMLInputSource.java From openjdk-8-source with GNU General Public License v2.0 | 3 votes |
/** * Constructs an input source from a XMLResourceIdentifier * object, leaving resolution of the entity and opening of * the input stream up to the caller. * * @param resourceIdentifier the XMLResourceIdentifier containing the information */ public XMLInputSource(XMLResourceIdentifier resourceIdentifier) { fPublicId = resourceIdentifier.getPublicId(); fSystemId = resourceIdentifier.getLiteralSystemId(); fBaseSystemId = resourceIdentifier.getBaseSystemId(); }