Java Code Examples for com.sun.org.apache.xerces.internal.util.XMLChar#isPubid()

The following examples show how to use com.sun.org.apache.xerces.internal.util.XMLChar#isPubid() . 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: XML11DTDScannerImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  it could really only be \n or 0x20; all else is normalized, no?  - neilg
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 2
Source File: XML11DTDScannerImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  it could really only be \n or 0x20; all else is normalized, no?  - neilg
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 3
Source File: XML11DocumentScannerImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar();
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar();
         // REVISIT:  none of these except \n and 0x20 should make it past the entity scanner
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 4
Source File: XML11DocumentScannerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  none of these except \n and 0x20 should make it past the entity scanner
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 5
Source File: XML11DTDScannerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  it could really only be \n or 0x20; all else is normalized, no?  - neilg
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 6
Source File: XMLScanner.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans public ID literal.
 *
 * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
 * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
 *
 * The returned string is normalized according to the following rule,
 * from http://www.w3.org/TR/REC-xml#dt-pubid:
 *
 * Before a match is attempted, all strings of white space in the public
 * identifier must be normalized to single space characters (#x20), and
 * leading and trailing white space must be removed.
 *
 * @param literal The string to fill in with the public ID literal.
 * @return True on success.
 *
 * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
 * the time of calling is lost.
 */
protected boolean scanPubidLiteral(XMLString literal)
throws IOException, XNIException {
    int quote = fEntityScanner.scanChar(null);
    if (quote != '\'' && quote != '"') {
        reportFatalError("QuoteRequiredInPublicID", null);
        return false;
    }

    fStringBuffer.clear();
    // skip leading whitespace
    boolean skipSpace = true;
    boolean dataok = true;
    while (true) {
        int c = fEntityScanner.scanChar(null);
        if (c == ' ' || c == '\n' || c == '\r') {
            if (!skipSpace) {
                // take the first whitespace as a space and skip the others
                fStringBuffer.append(' ');
                skipSpace = true;
            }
        } else if (c == quote) {
            if (skipSpace) {
                // if we finished on a space let's trim it
                fStringBuffer.length--;
            }
            literal.setValues(fStringBuffer);
            break;
        } else if (XMLChar.isPubid(c)) {
            fStringBuffer.append((char)c);
            skipSpace = false;
        } else if (c == -1) {
            reportFatalError("PublicIDUnterminated", null);
            return false;
        } else {
            dataok = false;
            reportFatalError("InvalidCharInPublicID",
                    new Object[]{Integer.toHexString(c)});
        }
    }
    return dataok;
}
 
Example 7
Source File: XML11DocumentScannerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  none of these except \n and 0x20 should make it past the entity scanner
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 8
Source File: XML11DTDScannerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  it could really only be \n or 0x20; all else is normalized, no?  - neilg
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 9
Source File: XMLScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans public ID literal.
 *
 * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
 * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
 *
 * The returned string is normalized according to the following rule,
 * from http://www.w3.org/TR/REC-xml#dt-pubid:
 *
 * Before a match is attempted, all strings of white space in the public
 * identifier must be normalized to single space characters (#x20), and
 * leading and trailing white space must be removed.
 *
 * @param literal The string to fill in with the public ID literal.
 * @return True on success.
 *
 * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
 * the time of calling is lost.
 */
protected boolean scanPubidLiteral(XMLString literal)
throws IOException, XNIException {
    int quote = fEntityScanner.scanChar(null);
    if (quote != '\'' && quote != '"') {
        reportFatalError("QuoteRequiredInPublicID", null);
        return false;
    }

    fStringBuffer.clear();
    // skip leading whitespace
    boolean skipSpace = true;
    boolean dataok = true;
    while (true) {
        int c = fEntityScanner.scanChar(null);
        if (c == ' ' || c == '\n' || c == '\r') {
            if (!skipSpace) {
                // take the first whitespace as a space and skip the others
                fStringBuffer.append(' ');
                skipSpace = true;
            }
        } else if (c == quote) {
            if (skipSpace) {
                // if we finished on a space let's trim it
                fStringBuffer.length--;
            }
            literal.setValues(fStringBuffer);
            break;
        } else if (XMLChar.isPubid(c)) {
            fStringBuffer.append((char)c);
            skipSpace = false;
        } else if (c == -1) {
            reportFatalError("PublicIDUnterminated", null);
            return false;
        } else {
            dataok = false;
            reportFatalError("InvalidCharInPublicID",
                    new Object[]{Integer.toHexString(c)});
        }
    }
    return dataok;
}
 
Example 10
Source File: XML11DTDScannerImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar();
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar();
         // REVISIT:  it could really only be \n or 0x20; all else is normalized, no?  - neilg
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 11
Source File: XMLScanner.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Scans public ID literal.
 *
 * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
 * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
 *
 * The returned string is normalized according to the following rule,
 * from http://www.w3.org/TR/REC-xml#dt-pubid:
 *
 * Before a match is attempted, all strings of white space in the public
 * identifier must be normalized to single space characters (#x20), and
 * leading and trailing white space must be removed.
 *
 * @param literal The string to fill in with the public ID literal.
 * @return True on success.
 *
 * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
 * the time of calling is lost.
 */
protected boolean scanPubidLiteral(XMLString literal)
throws IOException, XNIException {
    int quote = fEntityScanner.scanChar(null);
    if (quote != '\'' && quote != '"') {
        reportFatalError("QuoteRequiredInPublicID", null);
        return false;
    }

    fStringBuffer.clear();
    // skip leading whitespace
    boolean skipSpace = true;
    boolean dataok = true;
    while (true) {
        int c = fEntityScanner.scanChar(null);
        if (c == ' ' || c == '\n' || c == '\r') {
            if (!skipSpace) {
                // take the first whitespace as a space and skip the others
                fStringBuffer.append(' ');
                skipSpace = true;
            }
        } else if (c == quote) {
            if (skipSpace) {
                // if we finished on a space let's trim it
                fStringBuffer.length--;
            }
            literal.setValues(fStringBuffer);
            break;
        } else if (XMLChar.isPubid(c)) {
            fStringBuffer.append((char)c);
            skipSpace = false;
        } else if (c == -1) {
            reportFatalError("PublicIDUnterminated", null);
            return false;
        } else {
            dataok = false;
            reportFatalError("InvalidCharInPublicID",
                    new Object[]{Integer.toHexString(c)});
        }
    }
    return dataok;
}
 
Example 12
Source File: XMLScanner.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans public ID literal.
 *
 * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
 * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
 *
 * The returned string is normalized according to the following rule,
 * from http://www.w3.org/TR/REC-xml#dt-pubid:
 *
 * Before a match is attempted, all strings of white space in the public
 * identifier must be normalized to single space characters (#x20), and
 * leading and trailing white space must be removed.
 *
 * @param literal The string to fill in with the public ID literal.
 * @return True on success.
 *
 * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
 * the time of calling is lost.
 */
protected boolean scanPubidLiteral(XMLString literal)
throws IOException, XNIException {
    int quote = fEntityScanner.scanChar(null);
    if (quote != '\'' && quote != '"') {
        reportFatalError("QuoteRequiredInPublicID", null);
        return false;
    }

    fStringBuffer.clear();
    // skip leading whitespace
    boolean skipSpace = true;
    boolean dataok = true;
    while (true) {
        int c = fEntityScanner.scanChar(null);
        if (c == ' ' || c == '\n' || c == '\r') {
            if (!skipSpace) {
                // take the first whitespace as a space and skip the others
                fStringBuffer.append(' ');
                skipSpace = true;
            }
        } else if (c == quote) {
            if (skipSpace) {
                // if we finished on a space let's trim it
                fStringBuffer.length--;
            }
            literal.setValues(fStringBuffer);
            break;
        } else if (XMLChar.isPubid(c)) {
            fStringBuffer.append((char)c);
            skipSpace = false;
        } else if (c == -1) {
            reportFatalError("PublicIDUnterminated", null);
            return false;
        } else {
            dataok = false;
            reportFatalError("InvalidCharInPublicID",
                    new Object[]{Integer.toHexString(c)});
        }
    }
    return dataok;
}
 
Example 13
Source File: XML11DocumentScannerImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  none of these except \n and 0x20 should make it past the entity scanner
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 14
Source File: XML11DocumentScannerImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar();
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar();
         // REVISIT:  none of these except \n and 0x20 should make it past the entity scanner
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 15
Source File: XMLScanner.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans public ID literal.
 *
 * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
 * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
 *
 * The returned string is normalized according to the following rule,
 * from http://www.w3.org/TR/REC-xml#dt-pubid:
 *
 * Before a match is attempted, all strings of white space in the public
 * identifier must be normalized to single space characters (#x20), and
 * leading and trailing white space must be removed.
 *
 * @param literal The string to fill in with the public ID literal.
 * @return True on success.
 *
 * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
 * the time of calling is lost.
 */
protected boolean scanPubidLiteral(XMLString literal)
throws IOException, XNIException {
    int quote = fEntityScanner.scanChar();
    if (quote != '\'' && quote != '"') {
        reportFatalError("QuoteRequiredInPublicID", null);
        return false;
    }

    fStringBuffer.clear();
    // skip leading whitespace
    boolean skipSpace = true;
    boolean dataok = true;
    while (true) {
        int c = fEntityScanner.scanChar();
        if (c == ' ' || c == '\n' || c == '\r') {
            if (!skipSpace) {
                // take the first whitespace as a space and skip the others
                fStringBuffer.append(' ');
                skipSpace = true;
            }
        } else if (c == quote) {
            if (skipSpace) {
                // if we finished on a space let's trim it
                fStringBuffer.length--;
            }
            literal.setValues(fStringBuffer);
            break;
        } else if (XMLChar.isPubid(c)) {
            fStringBuffer.append((char)c);
            skipSpace = false;
        } else if (c == -1) {
            reportFatalError("PublicIDUnterminated", null);
            return false;
        } else {
            dataok = false;
            reportFatalError("InvalidCharInPublicID",
                    new Object[]{Integer.toHexString(c)});
        }
    }
    return dataok;
}
 
Example 16
Source File: XML11DocumentScannerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  none of these except \n and 0x20 should make it past the entity scanner
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 17
Source File: XML11DTDScannerImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  it could really only be \n or 0x20; all else is normalized, no?  - neilg
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 18
Source File: XMLScanner.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Scans public ID literal.
 *
 * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
 * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
 *
 * The returned string is normalized according to the following rule,
 * from http://www.w3.org/TR/REC-xml#dt-pubid:
 *
 * Before a match is attempted, all strings of white space in the public
 * identifier must be normalized to single space characters (#x20), and
 * leading and trailing white space must be removed.
 *
 * @param literal The string to fill in with the public ID literal.
 * @return True on success.
 *
 * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
 * the time of calling is lost.
 */
protected boolean scanPubidLiteral(XMLString literal)
throws IOException, XNIException {
    int quote = fEntityScanner.scanChar(null);
    if (quote != '\'' && quote != '"') {
        reportFatalError("QuoteRequiredInPublicID", null);
        return false;
    }

    fStringBuffer.clear();
    // skip leading whitespace
    boolean skipSpace = true;
    boolean dataok = true;
    while (true) {
        int c = fEntityScanner.scanChar(null);
        if (c == ' ' || c == '\n' || c == '\r') {
            if (!skipSpace) {
                // take the first whitespace as a space and skip the others
                fStringBuffer.append(' ');
                skipSpace = true;
            }
        } else if (c == quote) {
            if (skipSpace) {
                // if we finished on a space let's trim it
                fStringBuffer.length--;
            }
            literal.setValues(fStringBuffer);
            break;
        } else if (XMLChar.isPubid(c)) {
            fStringBuffer.append((char)c);
            skipSpace = false;
        } else if (c == -1) {
            reportFatalError("PublicIDUnterminated", null);
            return false;
        } else {
            dataok = false;
            reportFatalError("InvalidCharInPublicID",
                    new Object[]{Integer.toHexString(c)});
        }
    }
    return dataok;
}
 
Example 19
Source File: XML11DocumentScannerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  none of these except \n and 0x20 should make it past the entity scanner
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}
 
Example 20
Source File: XML11DTDScannerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
  * Scans public ID literal.
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  *
  * The returned string is normalized according to the following rule,
  * from http://www.w3.org/TR/REC-xml#dt-pubid:
  *
  * Before a match is attempted, all strings of white space in the public
  * identifier must be normalized to single space characters (#x20), and
  * leading and trailing white space must be removed.
  *
  * @param literal The string to fill in with the public ID literal.
  * @return True on success.
  *
  * <strong>Note:</strong> This method uses fStringBuffer, anything in it at
  * the time of calling is lost.
  */
 protected boolean scanPubidLiteral(XMLString literal)
     throws IOException, XNIException
 {
     int quote = fEntityScanner.scanChar(null);
     if (quote != '\'' && quote != '"') {
         reportFatalError("QuoteRequiredInPublicID", null);
         return false;
     }

     fStringBuffer.clear();
     // skip leading whitespace
     boolean skipSpace = true;
     boolean dataok = true;
     while (true) {
         int c = fEntityScanner.scanChar(null);
         // REVISIT:  it could really only be \n or 0x20; all else is normalized, no?  - neilg
         if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) {
             if (!skipSpace) {
                 // take the first whitespace as a space and skip the others
                 fStringBuffer.append(' ');
                 skipSpace = true;
             }
         }
         else if (c == quote) {
             if (skipSpace) {
                 // if we finished on a space let's trim it
                 fStringBuffer.length--;
             }
             literal.setValues(fStringBuffer);
             break;
         }
         else if (XMLChar.isPubid(c)) {
             fStringBuffer.append((char)c);
             skipSpace = false;
         }
         else if (c == -1) {
             reportFatalError("PublicIDUnterminated", null);
             return false;
         }
         else {
             dataok = false;
             reportFatalError("InvalidCharInPublicID",
                              new Object[]{Integer.toHexString(c)});
         }
     }
     return dataok;
}