Java Code Examples for com.sun.org.apache.xerces.internal.xni.XMLString#toString()

The following examples show how to use com.sun.org.apache.xerces.internal.xni.XMLString#toString() . 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-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 2
Source File: XMLScanner.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans External ID and return the public and system IDs.
 *
 * @param identifiers An array of size 2 to return the system id,
 *                    and public id (in that order).
 * @param optionalSystemId Specifies whether the system id is optional.
 *
 * <strong>Note:</strong> This method uses fString and fStringBuffer,
 * anything in them at the time of calling is lost.
 */
protected void scanExternalID(String[] identifiers,
        boolean optionalSystemId)
        throws IOException, XNIException {

    String systemId = null;
    String publicId = null;
    if (fEntityScanner.skipString("PUBLIC")) {
        if (!fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterPUBLIC", null);
        }
        scanPubidLiteral(fString);
        publicId = fString.toString();

        if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
            reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
        }
    }

    if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
        if (publicId == null && !fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterSYSTEM", null);
        }
        int quote = fEntityScanner.peekChar();
        if (quote != '\'' && quote != '"') {
            if (publicId != null && optionalSystemId) {
                // looks like we don't have any system id
                // simply return the public id
                identifiers[0] = null;
                identifiers[1] = publicId;
                return;
            }
            reportFatalError("QuoteRequiredInSystemID", null);
        }
        fEntityScanner.scanChar();
        XMLString ident = fString;
        if (fEntityScanner.scanLiteral(quote, ident) != quote) {
            fStringBuffer.clear();
            do {
                fStringBuffer.append(ident);
                int c = fEntityScanner.peekChar();
                if (XMLChar.isMarkup(c) || c == ']') {
                    fStringBuffer.append((char)fEntityScanner.scanChar());
                } else if (c != -1 && isInvalidLiteral(c)) {
                    reportFatalError("InvalidCharInSystemID",
                        new Object[] {Integer.toString(c, 16)});
                }
            } while (fEntityScanner.scanLiteral(quote, ident) != quote);
            fStringBuffer.append(ident);
            ident = fStringBuffer;
        }
        systemId = ident.toString();
        if (!fEntityScanner.skipChar(quote)) {
            reportFatalError("SystemIDUnterminated", null);
        }
    }

    // store result in array
    identifiers[0] = systemId;
    identifiers[1] = publicId;
}
 
Example 3
Source File: AbstractSAXParser.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 4
Source File: XMLScanner.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans External ID and return the public and system IDs.
 *
 * @param identifiers An array of size 2 to return the system id,
 *                    and public id (in that order).
 * @param optionalSystemId Specifies whether the system id is optional.
 *
 * <strong>Note:</strong> This method uses fString and fStringBuffer,
 * anything in them at the time of calling is lost.
 */
protected void scanExternalID(String[] identifiers,
        boolean optionalSystemId)
        throws IOException, XNIException {

    String systemId = null;
    String publicId = null;
    if (fEntityScanner.skipString("PUBLIC")) {
        if (!fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterPUBLIC", null);
        }
        scanPubidLiteral(fString);
        publicId = fString.toString();

        if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
            reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
        }
    }

    if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
        if (publicId == null && !fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterSYSTEM", null);
        }
        int quote = fEntityScanner.peekChar();
        if (quote != '\'' && quote != '"') {
            if (publicId != null && optionalSystemId) {
                // looks like we don't have any system id
                // simply return the public id
                identifiers[0] = null;
                identifiers[1] = publicId;
                return;
            }
            reportFatalError("QuoteRequiredInSystemID", null);
        }
        fEntityScanner.scanChar();
        XMLString ident = fString;
        if (fEntityScanner.scanLiteral(quote, ident) != quote) {
            fStringBuffer.clear();
            do {
                fStringBuffer.append(ident);
                int c = fEntityScanner.peekChar();
                if (XMLChar.isMarkup(c) || c == ']') {
                    fStringBuffer.append((char)fEntityScanner.scanChar());
                } else if (c != -1 && isInvalidLiteral(c)) {
                    reportFatalError("InvalidCharInSystemID",
                        new Object[] {Integer.toString(c, 16)});
                }
            } while (fEntityScanner.scanLiteral(quote, ident) != quote);
            fStringBuffer.append(ident);
            ident = fStringBuffer;
        }
        systemId = ident.toString();
        if (!fEntityScanner.skipChar(quote)) {
            reportFatalError("SystemIDUnterminated", null);
        }
    }

    // store result in array
    identifiers[0] = systemId;
    identifiers[1] = publicId;
}
 
Example 5
Source File: AbstractSAXParser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 6
Source File: AbstractSAXParser.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 7
Source File: AbstractSAXParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 8
Source File: XMLScanner.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Scans External ID and return the public and system IDs.
 *
 * @param identifiers An array of size 2 to return the system id,
 *                    and public id (in that order).
 * @param optionalSystemId Specifies whether the system id is optional.
 *
 * <strong>Note:</strong> This method uses fString and fStringBuffer,
 * anything in them at the time of calling is lost.
 */
protected void scanExternalID(String[] identifiers,
        boolean optionalSystemId)
        throws IOException, XNIException {

    String systemId = null;
    String publicId = null;
    if (fEntityScanner.skipString("PUBLIC")) {
        if (!fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterPUBLIC", null);
        }
        scanPubidLiteral(fString);
        publicId = fString.toString();

        if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
            reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
        }
    }

    if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
        if (publicId == null && !fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterSYSTEM", null);
        }
        int quote = fEntityScanner.peekChar();
        if (quote != '\'' && quote != '"') {
            if (publicId != null && optionalSystemId) {
                // looks like we don't have any system id
                // simply return the public id
                identifiers[0] = null;
                identifiers[1] = publicId;
                return;
            }
            reportFatalError("QuoteRequiredInSystemID", null);
        }
        fEntityScanner.scanChar(null);
        XMLString ident = fString;
        if (fEntityScanner.scanLiteral(quote, ident, false) != quote) {
            fStringBuffer.clear();
            do {
                fStringBuffer.append(ident);
                int c = fEntityScanner.peekChar();
                if (XMLChar.isMarkup(c) || c == ']') {
                    fStringBuffer.append((char)fEntityScanner.scanChar(null));
                } else if (c != -1 && isInvalidLiteral(c)) {
                    reportFatalError("InvalidCharInSystemID",
                        new Object[] {Integer.toString(c, 16)});
                }
            } while (fEntityScanner.scanLiteral(quote, ident, false) != quote);
            fStringBuffer.append(ident);
            ident = fStringBuffer;
        }
        systemId = ident.toString();
        if (!fEntityScanner.skipChar(quote, null)) {
            reportFatalError("SystemIDUnterminated", null);
        }
    }

    // store result in array
    identifiers[0] = systemId;
    identifiers[1] = publicId;
}
 
Example 9
Source File: AbstractSAXParser.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 10
Source File: XMLScanner.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans External ID and return the public and system IDs.
 *
 * @param identifiers An array of size 2 to return the system id,
 *                    and public id (in that order).
 * @param optionalSystemId Specifies whether the system id is optional.
 *
 * <strong>Note:</strong> This method uses fString and fStringBuffer,
 * anything in them at the time of calling is lost.
 */
protected void scanExternalID(String[] identifiers,
        boolean optionalSystemId)
        throws IOException, XNIException {

    String systemId = null;
    String publicId = null;
    if (fEntityScanner.skipString("PUBLIC")) {
        if (!fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterPUBLIC", null);
        }
        scanPubidLiteral(fString);
        publicId = fString.toString();

        if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
            reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
        }
    }

    if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
        if (publicId == null && !fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterSYSTEM", null);
        }
        int quote = fEntityScanner.peekChar();
        if (quote != '\'' && quote != '"') {
            if (publicId != null && optionalSystemId) {
                // looks like we don't have any system id
                // simply return the public id
                identifiers[0] = null;
                identifiers[1] = publicId;
                return;
            }
            reportFatalError("QuoteRequiredInSystemID", null);
        }
        fEntityScanner.scanChar(null);
        XMLString ident = fString;
        if (fEntityScanner.scanLiteral(quote, ident, false) != quote) {
            fStringBuffer.clear();
            do {
                fStringBuffer.append(ident);
                int c = fEntityScanner.peekChar();
                if (XMLChar.isMarkup(c) || c == ']') {
                    fStringBuffer.append((char)fEntityScanner.scanChar(null));
                } else if (c != -1 && isInvalidLiteral(c)) {
                    reportFatalError("InvalidCharInSystemID",
                        new Object[] {Integer.toString(c, 16)});
                }
            } while (fEntityScanner.scanLiteral(quote, ident, false) != quote);
            fStringBuffer.append(ident);
            ident = fStringBuffer;
        }
        systemId = ident.toString();
        if (!fEntityScanner.skipChar(quote, null)) {
            reportFatalError("SystemIDUnterminated", null);
        }
    }

    // store result in array
    identifiers[0] = systemId;
    identifiers[1] = publicId;
}
 
Example 11
Source File: AbstractSAXParser.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 12
Source File: XMLScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans External ID and return the public and system IDs.
 *
 * @param identifiers An array of size 2 to return the system id,
 *                    and public id (in that order).
 * @param optionalSystemId Specifies whether the system id is optional.
 *
 * <strong>Note:</strong> This method uses fString and fStringBuffer,
 * anything in them at the time of calling is lost.
 */
protected void scanExternalID(String[] identifiers,
        boolean optionalSystemId)
        throws IOException, XNIException {

    String systemId = null;
    String publicId = null;
    if (fEntityScanner.skipString("PUBLIC")) {
        if (!fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterPUBLIC", null);
        }
        scanPubidLiteral(fString);
        publicId = fString.toString();

        if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
            reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
        }
    }

    if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
        if (publicId == null && !fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterSYSTEM", null);
        }
        int quote = fEntityScanner.peekChar();
        if (quote != '\'' && quote != '"') {
            if (publicId != null && optionalSystemId) {
                // looks like we don't have any system id
                // simply return the public id
                identifiers[0] = null;
                identifiers[1] = publicId;
                return;
            }
            reportFatalError("QuoteRequiredInSystemID", null);
        }
        fEntityScanner.scanChar(null);
        XMLString ident = fString;
        if (fEntityScanner.scanLiteral(quote, ident, false) != quote) {
            fStringBuffer.clear();
            do {
                fStringBuffer.append(ident);
                int c = fEntityScanner.peekChar();
                if (XMLChar.isMarkup(c) || c == ']') {
                    fStringBuffer.append((char)fEntityScanner.scanChar(null));
                } else if (c != -1 && isInvalidLiteral(c)) {
                    reportFatalError("InvalidCharInSystemID",
                        new Object[] {Integer.toString(c, 16)});
                }
            } while (fEntityScanner.scanLiteral(quote, ident, false) != quote);
            fStringBuffer.append(ident);
            ident = fStringBuffer;
        }
        systemId = ident.toString();
        if (!fEntityScanner.skipChar(quote, null)) {
            reportFatalError("SystemIDUnterminated", null);
        }
    }

    // store result in array
    identifiers[0] = systemId;
    identifiers[1] = publicId;
}
 
Example 13
Source File: AbstractSAXParser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 14
Source File: XMLScanner.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Scans External ID and return the public and system IDs.
 *
 * @param identifiers An array of size 2 to return the system id,
 *                    and public id (in that order).
 * @param optionalSystemId Specifies whether the system id is optional.
 *
 * <strong>Note:</strong> This method uses fString and fStringBuffer,
 * anything in them at the time of calling is lost.
 */
protected void scanExternalID(String[] identifiers,
        boolean optionalSystemId)
        throws IOException, XNIException {

    String systemId = null;
    String publicId = null;
    if (fEntityScanner.skipString("PUBLIC")) {
        if (!fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterPUBLIC", null);
        }
        scanPubidLiteral(fString);
        publicId = fString.toString();

        if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
            reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
        }
    }

    if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
        if (publicId == null && !fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterSYSTEM", null);
        }
        int quote = fEntityScanner.peekChar();
        if (quote != '\'' && quote != '"') {
            if (publicId != null && optionalSystemId) {
                // looks like we don't have any system id
                // simply return the public id
                identifiers[0] = null;
                identifiers[1] = publicId;
                return;
            }
            reportFatalError("QuoteRequiredInSystemID", null);
        }
        fEntityScanner.scanChar(null);
        XMLString ident = fString;
        if (fEntityScanner.scanLiteral(quote, ident, false) != quote) {
            fStringBuffer.clear();
            do {
                fStringBuffer.append(ident);
                int c = fEntityScanner.peekChar();
                if (XMLChar.isMarkup(c) || c == ']') {
                    fStringBuffer.append((char)fEntityScanner.scanChar(null));
                } else if (c != -1 && isInvalidLiteral(c)) {
                    reportFatalError("InvalidCharInSystemID",
                        new Object[] {Integer.toString(c, 16)});
                }
            } while (fEntityScanner.scanLiteral(quote, ident, false) != quote);
            fStringBuffer.append(ident);
            ident = fStringBuffer;
        }
        systemId = ident.toString();
        if (!fEntityScanner.skipChar(quote, null)) {
            reportFatalError("SystemIDUnterminated", null);
        }
    }

    // store result in array
    identifiers[0] = systemId;
    identifiers[1] = publicId;
}
 
Example 15
Source File: AbstractSAXParser.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 16
Source File: XMLScanner.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans External ID and return the public and system IDs.
 *
 * @param identifiers An array of size 2 to return the system id,
 *                    and public id (in that order).
 * @param optionalSystemId Specifies whether the system id is optional.
 *
 * <strong>Note:</strong> This method uses fString and fStringBuffer,
 * anything in them at the time of calling is lost.
 */
protected void scanExternalID(String[] identifiers,
        boolean optionalSystemId)
        throws IOException, XNIException {

    String systemId = null;
    String publicId = null;
    if (fEntityScanner.skipString("PUBLIC")) {
        if (!fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterPUBLIC", null);
        }
        scanPubidLiteral(fString);
        publicId = fString.toString();

        if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
            reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
        }
    }

    if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
        if (publicId == null && !fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterSYSTEM", null);
        }
        int quote = fEntityScanner.peekChar();
        if (quote != '\'' && quote != '"') {
            if (publicId != null && optionalSystemId) {
                // looks like we don't have any system id
                // simply return the public id
                identifiers[0] = null;
                identifiers[1] = publicId;
                return;
            }
            reportFatalError("QuoteRequiredInSystemID", null);
        }
        fEntityScanner.scanChar();
        XMLString ident = fString;
        if (fEntityScanner.scanLiteral(quote, ident) != quote) {
            fStringBuffer.clear();
            do {
                fStringBuffer.append(ident);
                int c = fEntityScanner.peekChar();
                if (XMLChar.isMarkup(c) || c == ']') {
                    fStringBuffer.append((char)fEntityScanner.scanChar());
                } else if (c != -1 && isInvalidLiteral(c)) {
                    reportFatalError("InvalidCharInSystemID",
                        new Object[] {Integer.toString(c, 16)});
                }
            } while (fEntityScanner.scanLiteral(quote, ident) != quote);
            fStringBuffer.append(ident);
            ident = fStringBuffer;
        }
        systemId = ident.toString();
        if (!fEntityScanner.skipChar(quote)) {
            reportFatalError("SystemIDUnterminated", null);
        }
    }

    // store result in array
    identifiers[0] = systemId;
    identifiers[1] = publicId;
}
 
Example 17
Source File: AbstractSAXParser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 18
Source File: XMLScanner.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans External ID and return the public and system IDs.
 *
 * @param identifiers An array of size 2 to return the system id,
 *                    and public id (in that order).
 * @param optionalSystemId Specifies whether the system id is optional.
 *
 * <strong>Note:</strong> This method uses fString and fStringBuffer,
 * anything in them at the time of calling is lost.
 */
protected void scanExternalID(String[] identifiers,
        boolean optionalSystemId)
        throws IOException, XNIException {

    String systemId = null;
    String publicId = null;
    if (fEntityScanner.skipString("PUBLIC")) {
        if (!fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterPUBLIC", null);
        }
        scanPubidLiteral(fString);
        publicId = fString.toString();

        if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
            reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
        }
    }

    if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
        if (publicId == null && !fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterSYSTEM", null);
        }
        int quote = fEntityScanner.peekChar();
        if (quote != '\'' && quote != '"') {
            if (publicId != null && optionalSystemId) {
                // looks like we don't have any system id
                // simply return the public id
                identifiers[0] = null;
                identifiers[1] = publicId;
                return;
            }
            reportFatalError("QuoteRequiredInSystemID", null);
        }
        fEntityScanner.scanChar();
        XMLString ident = fString;
        if (fEntityScanner.scanLiteral(quote, ident) != quote) {
            fStringBuffer.clear();
            do {
                fStringBuffer.append(ident);
                int c = fEntityScanner.peekChar();
                if (XMLChar.isMarkup(c) || c == ']') {
                    fStringBuffer.append((char)fEntityScanner.scanChar());
                } else if (c != -1 && isInvalidLiteral(c)) {
                    reportFatalError("InvalidCharInSystemID",
                        new Object[] {Integer.toString(c, 16)});
                }
            } while (fEntityScanner.scanLiteral(quote, ident) != quote);
            fStringBuffer.append(ident);
            ident = fStringBuffer;
        }
        systemId = ident.toString();
        if (!fEntityScanner.skipChar(quote)) {
            reportFatalError("SystemIDUnterminated", null);
        }
    }

    // store result in array
    identifiers[0] = systemId;
    identifiers[1] = publicId;
}
 
Example 19
Source File: AbstractSAXParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") ||
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
Example 20
Source File: XMLScanner.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Scans External ID and return the public and system IDs.
 *
 * @param identifiers An array of size 2 to return the system id,
 *                    and public id (in that order).
 * @param optionalSystemId Specifies whether the system id is optional.
 *
 * <strong>Note:</strong> This method uses fString and fStringBuffer,
 * anything in them at the time of calling is lost.
 */
protected void scanExternalID(String[] identifiers,
        boolean optionalSystemId)
        throws IOException, XNIException {

    String systemId = null;
    String publicId = null;
    if (fEntityScanner.skipString("PUBLIC")) {
        if (!fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterPUBLIC", null);
        }
        scanPubidLiteral(fString);
        publicId = fString.toString();

        if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
            reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
        }
    }

    if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
        if (publicId == null && !fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterSYSTEM", null);
        }
        int quote = fEntityScanner.peekChar();
        if (quote != '\'' && quote != '"') {
            if (publicId != null && optionalSystemId) {
                // looks like we don't have any system id
                // simply return the public id
                identifiers[0] = null;
                identifiers[1] = publicId;
                return;
            }
            reportFatalError("QuoteRequiredInSystemID", null);
        }
        fEntityScanner.scanChar(null);
        XMLString ident = fString;
        if (fEntityScanner.scanLiteral(quote, ident, false) != quote) {
            fStringBuffer.clear();
            do {
                fStringBuffer.append(ident);
                int c = fEntityScanner.peekChar();
                if (XMLChar.isMarkup(c) || c == ']') {
                    fStringBuffer.append((char)fEntityScanner.scanChar(null));
                } else if (c != -1 && isInvalidLiteral(c)) {
                    reportFatalError("InvalidCharInSystemID",
                        new Object[] {Integer.toString(c, 16)});
                }
            } while (fEntityScanner.scanLiteral(quote, ident, false) != quote);
            fStringBuffer.append(ident);
            ident = fStringBuffer;
        }
        systemId = ident.toString();
        if (!fEntityScanner.skipChar(quote, null)) {
            reportFatalError("SystemIDUnterminated", null);
        }
    }

    // store result in array
    identifiers[0] = systemId;
    identifiers[1] = publicId;
}