Java Code Examples for com.sun.xml.internal.stream.Entity#ExternalEntity

The following examples show how to use com.sun.xml.internal.stream.Entity#ExternalEntity . 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: XMLEntityManager.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 2
Source File: XMLEntityManager.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 3
Source File: XMLEntityManager.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 4
Source File: XMLEntityManager.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 5
Source File: XMLEntityManager.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 6
Source File: XMLEntityManager.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 7
Source File: XMLEntityManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 8
Source File: XMLEntityManager.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 9
Source File: XMLEntityManager.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 10
Source File: XMLEntityManager.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 11
Source File: XMLEntityManager.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an unparsed entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name     The name of the entity.
 * @param publicId The public identifier of the entity.
 * @param systemId The system identifier of the entity.
 * @param notation The name of the notation.
 *
 * @see SymbolTable
 */
public void addUnparsedEntity(String name,
        String publicId, String systemId,
        String baseSystemId, String notation) {
    if (!fEntities.containsKey(name)) {
        Entity.ExternalEntity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, systemId, baseSystemId, null),
                notation, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }
}
 
Example 12
Source File: XMLEntityManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds an external entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name         The name of the entity.
 * @param publicId     The public identifier of the entity.
 * @param literalSystemId     The system identifier of the entity.
 * @param baseSystemId The base system identifier of the entity.
 *                     This is the system identifier of the entity
 *                     where <em>the entity being added</em> and
 *                     is used to expand the system identifier when
 *                     the system identifier is a relative URI.
 *                     When null the system identifier of the first
 *                     external entity on the stack is used instead.
 *
 * @see SymbolTable
 */
public void addExternalEntity(String name,
        String publicId, String literalSystemId,
        String baseSystemId) throws IOException {
    if (!fEntities.containsKey(name)) {
        if (baseSystemId == null) {
            // search for the first external entity on the stack
            int size = fEntityStack.size();
            if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
            }
            for (int i = size - 1; i >= 0 ; i--) {
                Entity.ScannedEntity externalEntity =
                        (Entity.ScannedEntity)fEntityStack.elementAt(i);
                if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) {
                    baseSystemId = externalEntity.entityLocation.getExpandedSystemId();
                    break;
                }
            }
        }
        Entity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, literalSystemId, baseSystemId,
                expandSystemId(literalSystemId, baseSystemId, false)), null, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }

}
 
Example 13
Source File: XMLEntityManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds an external entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name         The name of the entity.
 * @param publicId     The public identifier of the entity.
 * @param literalSystemId     The system identifier of the entity.
 * @param baseSystemId The base system identifier of the entity.
 *                     This is the system identifier of the entity
 *                     where <em>the entity being added</em> and
 *                     is used to expand the system identifier when
 *                     the system identifier is a relative URI.
 *                     When null the system identifier of the first
 *                     external entity on the stack is used instead.
 *
 * @see SymbolTable
 */
public void addExternalEntity(String name,
        String publicId, String literalSystemId,
        String baseSystemId) throws IOException {
    if (!fEntities.containsKey(name)) {
        if (baseSystemId == null) {
            // search for the first external entity on the stack
            int size = fEntityStack.size();
            if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
            }
            for (int i = size - 1; i >= 0 ; i--) {
                Entity.ScannedEntity externalEntity =
                        (Entity.ScannedEntity)fEntityStack.elementAt(i);
                if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) {
                    baseSystemId = externalEntity.entityLocation.getExpandedSystemId();
                    break;
                }
            }
        }
        Entity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, literalSystemId, baseSystemId,
                expandSystemId(literalSystemId, baseSystemId, false)), null, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }

}
 
Example 14
Source File: XMLEntityManager.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Adds an external entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name         The name of the entity.
 * @param publicId     The public identifier of the entity.
 * @param literalSystemId     The system identifier of the entity.
 * @param baseSystemId The base system identifier of the entity.
 *                     This is the system identifier of the entity
 *                     where <em>the entity being added</em> and
 *                     is used to expand the system identifier when
 *                     the system identifier is a relative URI.
 *                     When null the system identifier of the first
 *                     external entity on the stack is used instead.
 *
 * @see SymbolTable
 */
public void addExternalEntity(String name,
        String publicId, String literalSystemId,
        String baseSystemId) throws IOException {
    if (!fEntities.containsKey(name)) {
        if (baseSystemId == null) {
            // search for the first external entity on the stack
            int size = fEntityStack.size();
            if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
            }
            for (int i = size - 1; i >= 0 ; i--) {
                Entity.ScannedEntity externalEntity =
                        (Entity.ScannedEntity)fEntityStack.elementAt(i);
                if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) {
                    baseSystemId = externalEntity.entityLocation.getExpandedSystemId();
                    break;
                }
            }
        }
        Entity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, literalSystemId, baseSystemId,
                expandSystemId(literalSystemId, baseSystemId, false)), null, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }

}
 
Example 15
Source File: XMLEntityManager.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an external entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name         The name of the entity.
 * @param publicId     The public identifier of the entity.
 * @param literalSystemId     The system identifier of the entity.
 * @param baseSystemId The base system identifier of the entity.
 *                     This is the system identifier of the entity
 *                     where <em>the entity being added</em> and
 *                     is used to expand the system identifier when
 *                     the system identifier is a relative URI.
 *                     When null the system identifier of the first
 *                     external entity on the stack is used instead.
 *
 * @see SymbolTable
 */
public void addExternalEntity(String name,
        String publicId, String literalSystemId,
        String baseSystemId) throws IOException {
    if (!fEntities.containsKey(name)) {
        if (baseSystemId == null) {
            // search for the first external entity on the stack
            int size = fEntityStack.size();
            if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
            }
            for (int i = size - 1; i >= 0 ; i--) {
                Entity.ScannedEntity externalEntity =
                        (Entity.ScannedEntity)fEntityStack.get(i);
                if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) {
                    baseSystemId = externalEntity.entityLocation.getExpandedSystemId();
                    break;
                }
            }
        }
        Entity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, literalSystemId, baseSystemId,
                expandSystemId(literalSystemId, baseSystemId, false)), null, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }

}
 
Example 16
Source File: XMLEntityManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds an external entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name         The name of the entity.
 * @param publicId     The public identifier of the entity.
 * @param literalSystemId     The system identifier of the entity.
 * @param baseSystemId The base system identifier of the entity.
 *                     This is the system identifier of the entity
 *                     where <em>the entity being added</em> and
 *                     is used to expand the system identifier when
 *                     the system identifier is a relative URI.
 *                     When null the system identifier of the first
 *                     external entity on the stack is used instead.
 *
 * @see SymbolTable
 */
public void addExternalEntity(String name,
        String publicId, String literalSystemId,
        String baseSystemId) throws IOException {
    if (!fEntities.containsKey(name)) {
        if (baseSystemId == null) {
            // search for the first external entity on the stack
            int size = fEntityStack.size();
            if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
            }
            for (int i = size - 1; i >= 0 ; i--) {
                Entity.ScannedEntity externalEntity =
                        (Entity.ScannedEntity)fEntityStack.elementAt(i);
                if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) {
                    baseSystemId = externalEntity.entityLocation.getExpandedSystemId();
                    break;
                }
            }
        }
        Entity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, literalSystemId, baseSystemId,
                expandSystemId(literalSystemId, baseSystemId, false)), null, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }

}
 
Example 17
Source File: XMLEntityManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds an external entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name         The name of the entity.
 * @param publicId     The public identifier of the entity.
 * @param literalSystemId     The system identifier of the entity.
 * @param baseSystemId The base system identifier of the entity.
 *                     This is the system identifier of the entity
 *                     where <em>the entity being added</em> and
 *                     is used to expand the system identifier when
 *                     the system identifier is a relative URI.
 *                     When null the system identifier of the first
 *                     external entity on the stack is used instead.
 *
 * @see SymbolTable
 */
public void addExternalEntity(String name,
        String publicId, String literalSystemId,
        String baseSystemId) throws IOException {
    if (!fEntities.containsKey(name)) {
        if (baseSystemId == null) {
            // search for the first external entity on the stack
            int size = fEntityStack.size();
            if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
            }
            for (int i = size - 1; i >= 0 ; i--) {
                Entity.ScannedEntity externalEntity =
                        (Entity.ScannedEntity)fEntityStack.elementAt(i);
                if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) {
                    baseSystemId = externalEntity.entityLocation.getExpandedSystemId();
                    break;
                }
            }
        }
        Entity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, literalSystemId, baseSystemId,
                expandSystemId(literalSystemId, baseSystemId, false)), null, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }

}
 
Example 18
Source File: XMLEntityManager.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds an external entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name         The name of the entity.
 * @param publicId     The public identifier of the entity.
 * @param literalSystemId     The system identifier of the entity.
 * @param baseSystemId The base system identifier of the entity.
 *                     This is the system identifier of the entity
 *                     where <em>the entity being added</em> and
 *                     is used to expand the system identifier when
 *                     the system identifier is a relative URI.
 *                     When null the system identifier of the first
 *                     external entity on the stack is used instead.
 *
 * @see SymbolTable
 */
public void addExternalEntity(String name,
        String publicId, String literalSystemId,
        String baseSystemId) throws IOException {
    if (!fEntities.containsKey(name)) {
        if (baseSystemId == null) {
            // search for the first external entity on the stack
            int size = fEntityStack.size();
            if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
            }
            for (int i = size - 1; i >= 0 ; i--) {
                Entity.ScannedEntity externalEntity =
                        (Entity.ScannedEntity)fEntityStack.elementAt(i);
                if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) {
                    baseSystemId = externalEntity.entityLocation.getExpandedSystemId();
                    break;
                }
            }
        }
        Entity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, literalSystemId, baseSystemId,
                expandSystemId(literalSystemId, baseSystemId, false)), null, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }

}
 
Example 19
Source File: XMLEntityManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds an external entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name         The name of the entity.
 * @param publicId     The public identifier of the entity.
 * @param literalSystemId     The system identifier of the entity.
 * @param baseSystemId The base system identifier of the entity.
 *                     This is the system identifier of the entity
 *                     where <em>the entity being added</em> and
 *                     is used to expand the system identifier when
 *                     the system identifier is a relative URI.
 *                     When null the system identifier of the first
 *                     external entity on the stack is used instead.
 *
 * @see SymbolTable
 */
public void addExternalEntity(String name,
        String publicId, String literalSystemId,
        String baseSystemId) throws IOException {
    if (!fEntities.containsKey(name)) {
        if (baseSystemId == null) {
            // search for the first external entity on the stack
            int size = fEntityStack.size();
            if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
            }
            for (int i = size - 1; i >= 0 ; i--) {
                Entity.ScannedEntity externalEntity =
                        (Entity.ScannedEntity)fEntityStack.elementAt(i);
                if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) {
                    baseSystemId = externalEntity.entityLocation.getExpandedSystemId();
                    break;
                }
            }
        }
        Entity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, literalSystemId, baseSystemId,
                expandSystemId(literalSystemId, baseSystemId, false)), null, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }

}
 
Example 20
Source File: XMLEntityManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds an external entity declaration.
 * <p>
 * <strong>Note:</strong> This method ignores subsequent entity
 * declarations.
 * <p>
 * <strong>Note:</strong> The name should be a unique symbol. The
 * SymbolTable can be used for this purpose.
 *
 * @param name         The name of the entity.
 * @param publicId     The public identifier of the entity.
 * @param literalSystemId     The system identifier of the entity.
 * @param baseSystemId The base system identifier of the entity.
 *                     This is the system identifier of the entity
 *                     where <em>the entity being added</em> and
 *                     is used to expand the system identifier when
 *                     the system identifier is a relative URI.
 *                     When null the system identifier of the first
 *                     external entity on the stack is used instead.
 *
 * @see SymbolTable
 */
public void addExternalEntity(String name,
        String publicId, String literalSystemId,
        String baseSystemId) throws IOException {
    if (!fEntities.containsKey(name)) {
        if (baseSystemId == null) {
            // search for the first external entity on the stack
            int size = fEntityStack.size();
            if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
            }
            for (int i = size - 1; i >= 0 ; i--) {
                Entity.ScannedEntity externalEntity =
                        (Entity.ScannedEntity)fEntityStack.elementAt(i);
                if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) {
                    baseSystemId = externalEntity.entityLocation.getExpandedSystemId();
                    break;
                }
            }
        }
        Entity entity = new Entity.ExternalEntity(name,
                new XMLEntityDescriptionImpl(name, publicId, literalSystemId, baseSystemId,
                expandSystemId(literalSystemId, baseSystemId, false)), null, fInExternalSubset);
        fEntities.put(name, entity);
    } else{
        if(fWarnDuplicateEntityDef){
            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                    "MSG_DUPLICATE_ENTITY_DEFINITION",
                    new Object[]{ name },
                    XMLErrorReporter.SEVERITY_WARNING );
        }
    }

}