Java Code Examples for com.sun.org.apache.xerces.internal.util.XML11Char#isXML11ValidLiteral()

The following examples show how to use com.sun.org.apache.xerces.internal.util.XML11Char#isXML11ValidLiteral() . 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: XML11Serializer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected final void printXMLChar( int ch ) throws IOException {

        if (ch == '\r' || ch == 0x0085 || ch == 0x2028) {
                        printHex(ch);
        } else if ( ch == '<') {
            _printer.printText("&lt;");
        } else if (ch == '&') {
            _printer.printText("&amp;");
                } else if (ch == '>'){
                        // character sequence "]]>" can't appear in content, therefore
                        // we should escape '>'
                        _printer.printText("&gt;");
        } else if ( _encodingInfo.isPrintable((char)ch) && XML11Char.isXML11ValidLiteral(ch)) {
            _printer.printText((char)ch);
        } else {
             printHex(ch);
        }
    }
 
Example 2
Source File: XML11Serializer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected final void printXMLChar( int ch ) throws IOException {

        if (ch == '\r' || ch == 0x0085 || ch == 0x2028) {
                        printHex(ch);
        } else if ( ch == '<') {
            _printer.printText("&lt;");
        } else if (ch == '&') {
            _printer.printText("&amp;");
                } else if (ch == '>'){
                        // character sequence "]]>" can't appear in content, therefore
                        // we should escape '>'
                        _printer.printText("&gt;");
        } else if ( _encodingInfo.isPrintable((char)ch) && XML11Char.isXML11ValidLiteral(ch)) {
            _printer.printText((char)ch);
        } else {
             printHex(ch);
        }
    }
 
Example 3
Source File: XML11Serializer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected final void printXMLChar( int ch ) throws IOException {

        if (ch == '\r' || ch == 0x0085 || ch == 0x2028) {
                        printHex(ch);
        } else if ( ch == '<') {
            _printer.printText("&lt;");
        } else if (ch == '&') {
            _printer.printText("&amp;");
                } else if (ch == '>'){
                        // character sequence "]]>" can't appear in content, therefore
                        // we should escape '>'
                        _printer.printText("&gt;");
        } else if ( _encodingInfo.isPrintable((char)ch) && XML11Char.isXML11ValidLiteral(ch)) {
            _printer.printText((char)ch);
        } else {
             printHex(ch);
        }
    }
 
Example 4
Source File: XML11DocumentScannerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected boolean isInvalidLiteral(int value) {
    return (!XML11Char.isXML11ValidLiteral(value));
}
 
Example 5
Source File: XML11Serializer.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
protected void printText( char[] chars, int start, int length,
                          boolean preserveSpace, boolean unescaped ) throws IOException {
    int index;
    char ch;

    if ( preserveSpace ) {
        // Preserving spaces: the text must print exactly as it is,
        // without breaking when spaces appear in the text and without
        // consolidating spaces. If a line terminator is used, a line
        // break will occur.
        while ( length-- > 0 ) {
            ch = chars[start++];
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if ( length-- > 0) {
                    surrogates(ch, chars[start++]);
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }
            if ( unescaped && XML11Char.isXML11ValidLiteral(ch))
                _printer.printText( ch );
            else
                printXMLChar( ch );
        }
    } else {
        // Not preserving spaces: print one part at a time, and
        // use spaces between parts to break them into different
        // lines. Spaces at beginning of line will be stripped
        // by printing mechanism. Line terminator is treated
        // no different than other text part.
        while ( length-- > 0 ) {
            ch = chars[start++];
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if ( length-- > 0) {
                    surrogates(ch, chars[start++]);
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }

            if ( unescaped && XML11Char.isXML11ValidLiteral(ch))
                _printer.printText( ch );
            else
                printXMLChar( ch );
        }
    }
}
 
Example 6
Source File: XML11Serializer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected void printText( String text, boolean preserveSpace, boolean unescaped )
throws IOException {
    int index;
    char ch;
    int length = text.length();
    if ( preserveSpace ) {
        // Preserving spaces: the text must print exactly as it is,
        // without breaking when spaces appear in the text and without
        // consolidating spaces. If a line terminator is used, a line
        // break will occur.
        for ( index = 0 ; index < length ; ++index ) {
            ch = text.charAt( index );
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if (++index <length) {
                    surrogates(ch, text.charAt(index));
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }
            if ( unescaped  && XML11Char.isXML11ValidLiteral(ch)) {
                _printer.printText( ch );
            } else
                printXMLChar( ch );
        }
    } else {
        // Not preserving spaces: print one part at a time, and
        // use spaces between parts to break them into different
        // lines. Spaces at beginning of line will be stripped
        // by printing mechanism. Line terminator is treated
        // no different than other text part.
        for ( index = 0 ; index < length ; ++index ) {
            ch = text.charAt( index );
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if (++index <length) {
                    surrogates(ch, text.charAt(index));
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }

            if ( unescaped && XML11Char.isXML11ValidLiteral(ch) )
                _printer.printText( ch );
            else
                printXMLChar( ch);
        }
    }
}
 
Example 7
Source File: XML11Serializer.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
protected void printText( String text, boolean preserveSpace, boolean unescaped )
throws IOException {
    int index;
    char ch;
    int length = text.length();
    if ( preserveSpace ) {
        // Preserving spaces: the text must print exactly as it is,
        // without breaking when spaces appear in the text and without
        // consolidating spaces. If a line terminator is used, a line
        // break will occur.
        for ( index = 0 ; index < length ; ++index ) {
            ch = text.charAt( index );
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if (++index <length) {
                    surrogates(ch, text.charAt(index), true);
                } else {
                    fatalError("The character '"+ch+"' is an invalid XML character");
                }
                continue;
            }
            if ( unescaped  && XML11Char.isXML11ValidLiteral(ch)) {
                _printer.printText( ch );
            }
            else {
                printXMLChar( ch );
            }
        }
    }
    else {
        // Not preserving spaces: print one part at a time, and
        // use spaces between parts to break them into different
        // lines. Spaces at beginning of line will be stripped
        // by printing mechanism. Line terminator is treated
        // no different than other text part.
        for ( index = 0 ; index < length ; ++index ) {
            ch = text.charAt( index );
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if (++index <length) {
                    surrogates(ch, text.charAt(index), true);
                } else {
                    fatalError("The character '"+ch+"' is an invalid XML character");
                }
                continue;
            }

            if ( unescaped && XML11Char.isXML11ValidLiteral(ch) ) {
                _printer.printText( ch );
            }
            else {
                printXMLChar( ch );
            }
        }
    }
}
 
Example 8
Source File: XML11DocumentScannerImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
protected boolean isInvalidLiteral(int value) {
    return (!XML11Char.isXML11ValidLiteral(value));
}
 
Example 9
Source File: XML11DTDScannerImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
protected boolean isInvalidLiteral(int value) {
    return (!XML11Char.isXML11ValidLiteral(value));
}
 
Example 10
Source File: XML11Serializer.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected void printText( char[] chars, int start, int length,
                          boolean preserveSpace, boolean unescaped ) throws IOException {
    int index;
    char ch;

    if ( preserveSpace ) {
        // Preserving spaces: the text must print exactly as it is,
        // without breaking when spaces appear in the text and without
        // consolidating spaces. If a line terminator is used, a line
        // break will occur.
        while ( length-- > 0 ) {
            ch = chars[start++];
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if ( length-- > 0) {
                    surrogates(ch, chars[start++]);
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }
            if ( unescaped && XML11Char.isXML11ValidLiteral(ch))
                _printer.printText( ch );
            else
                printXMLChar( ch );
        }
    } else {
        // Not preserving spaces: print one part at a time, and
        // use spaces between parts to break them into different
        // lines. Spaces at beginning of line will be stripped
        // by printing mechanism. Line terminator is treated
        // no different than other text part.
        while ( length-- > 0 ) {
            ch = chars[start++];
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if ( length-- > 0) {
                    surrogates(ch, chars[start++]);
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }

            if ( unescaped && XML11Char.isXML11ValidLiteral(ch))
                _printer.printText( ch );
            else
                printXMLChar( ch );
        }
    }
}
 
Example 11
Source File: XML11Serializer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected void printText( char[] chars, int start, int length,
                          boolean preserveSpace, boolean unescaped ) throws IOException {
    int index;
    char ch;

    if ( preserveSpace ) {
        // Preserving spaces: the text must print exactly as it is,
        // without breaking when spaces appear in the text and without
        // consolidating spaces. If a line terminator is used, a line
        // break will occur.
        while ( length-- > 0 ) {
            ch = chars[start++];
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if ( length-- > 0) {
                    surrogates(ch, chars[start++]);
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }
            if ( unescaped && XML11Char.isXML11ValidLiteral(ch))
                _printer.printText( ch );
            else
                printXMLChar( ch );
        }
    } else {
        // Not preserving spaces: print one part at a time, and
        // use spaces between parts to break them into different
        // lines. Spaces at beginning of line will be stripped
        // by printing mechanism. Line terminator is treated
        // no different than other text part.
        while ( length-- > 0 ) {
            ch = chars[start++];
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if ( length-- > 0) {
                    surrogates(ch, chars[start++]);
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }

            if ( unescaped && XML11Char.isXML11ValidLiteral(ch))
                _printer.printText( ch );
            else
                printXMLChar( ch );
        }
    }
}
 
Example 12
Source File: XML11DTDScannerImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected boolean isInvalidLiteral(int value) {
    return (!XML11Char.isXML11ValidLiteral(value));
}
 
Example 13
Source File: XML11Serializer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected void printText( char[] chars, int start, int length,
                          boolean preserveSpace, boolean unescaped ) throws IOException {
    int index;
    char ch;

    if ( preserveSpace ) {
        // Preserving spaces: the text must print exactly as it is,
        // without breaking when spaces appear in the text and without
        // consolidating spaces. If a line terminator is used, a line
        // break will occur.
        while ( length-- > 0 ) {
            ch = chars[start++];
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if ( length-- > 0) {
                    surrogates(ch, chars[start++]);
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }
            if ( unescaped && XML11Char.isXML11ValidLiteral(ch))
                _printer.printText( ch );
            else
                printXMLChar( ch );
        }
    } else {
        // Not preserving spaces: print one part at a time, and
        // use spaces between parts to break them into different
        // lines. Spaces at beginning of line will be stripped
        // by printing mechanism. Line terminator is treated
        // no different than other text part.
        while ( length-- > 0 ) {
            ch = chars[start++];
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if ( length-- > 0) {
                    surrogates(ch, chars[start++]);
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }

            if ( unescaped && XML11Char.isXML11ValidLiteral(ch))
                _printer.printText( ch );
            else
                printXMLChar( ch );
        }
    }
}
 
Example 14
Source File: XML11DocumentScannerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected boolean isInvalidLiteral(int value) {
    return (!XML11Char.isXML11ValidLiteral(value));
}
 
Example 15
Source File: XML11Serializer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected void printText( String text, boolean preserveSpace, boolean unescaped )
throws IOException {
    int index;
    char ch;
    int length = text.length();
    if ( preserveSpace ) {
        // Preserving spaces: the text must print exactly as it is,
        // without breaking when spaces appear in the text and without
        // consolidating spaces. If a line terminator is used, a line
        // break will occur.
        for ( index = 0 ; index < length ; ++index ) {
            ch = text.charAt( index );
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if (++index <length) {
                    surrogates(ch, text.charAt(index));
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }
            if ( unescaped  && XML11Char.isXML11ValidLiteral(ch)) {
                _printer.printText( ch );
            } else
                printXMLChar( ch );
        }
    } else {
        // Not preserving spaces: print one part at a time, and
        // use spaces between parts to break them into different
        // lines. Spaces at beginning of line will be stripped
        // by printing mechanism. Line terminator is treated
        // no different than other text part.
        for ( index = 0 ; index < length ; ++index ) {
            ch = text.charAt( index );
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if (++index <length) {
                    surrogates(ch, text.charAt(index));
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }

            if ( unescaped && XML11Char.isXML11ValidLiteral(ch) )
                _printer.printText( ch );
            else
                printXMLChar( ch);
        }
    }
}
 
Example 16
Source File: XML11Serializer.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected void printText( String text, boolean preserveSpace, boolean unescaped )
throws IOException {
    int index;
    char ch;
    int length = text.length();
    if ( preserveSpace ) {
        // Preserving spaces: the text must print exactly as it is,
        // without breaking when spaces appear in the text and without
        // consolidating spaces. If a line terminator is used, a line
        // break will occur.
        for ( index = 0 ; index < length ; ++index ) {
            ch = text.charAt( index );
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if (++index <length) {
                    surrogates(ch, text.charAt(index));
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }
            if ( unescaped  && XML11Char.isXML11ValidLiteral(ch)) {
                _printer.printText( ch );
            } else
                printXMLChar( ch );
        }
    } else {
        // Not preserving spaces: print one part at a time, and
        // use spaces between parts to break them into different
        // lines. Spaces at beginning of line will be stripped
        // by printing mechanism. Line terminator is treated
        // no different than other text part.
        for ( index = 0 ; index < length ; ++index ) {
            ch = text.charAt( index );
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if (++index <length) {
                    surrogates(ch, text.charAt(index));
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }

            if ( unescaped && XML11Char.isXML11ValidLiteral(ch) )
                _printer.printText( ch );
            else
                printXMLChar( ch);
        }
    }
}
 
Example 17
Source File: XML11Serializer.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
protected void printText( char[] chars, int start, int length,
                          boolean preserveSpace, boolean unescaped ) throws IOException {
    int index;
    char ch;

    if ( preserveSpace ) {
        // Preserving spaces: the text must print exactly as it is,
        // without breaking when spaces appear in the text and without
        // consolidating spaces. If a line terminator is used, a line
        // break will occur.
        while ( length-- > 0 ) {
            ch = chars[start++];
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if ( length-- > 0) {
                    surrogates(ch, chars[start++]);
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }
            if ( unescaped && XML11Char.isXML11ValidLiteral(ch))
                _printer.printText( ch );
            else
                printXMLChar( ch );
        }
    } else {
        // Not preserving spaces: print one part at a time, and
        // use spaces between parts to break them into different
        // lines. Spaces at beginning of line will be stripped
        // by printing mechanism. Line terminator is treated
        // no different than other text part.
        while ( length-- > 0 ) {
            ch = chars[start++];
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if ( length-- > 0) {
                    surrogates(ch, chars[start++]);
                } else {
                    fatalError("The character '"+(char)ch+"' is an invalid XML character");
                }
                continue;
            }

            if ( unescaped && XML11Char.isXML11ValidLiteral(ch))
                _printer.printText( ch );
            else
                printXMLChar( ch );
        }
    }
}
 
Example 18
Source File: XML11DocumentScannerImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
protected boolean isInvalidLiteral(int value) {
    return (!XML11Char.isXML11ValidLiteral(value));
}
 
Example 19
Source File: XML11Serializer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected void printText( String text, boolean preserveSpace, boolean unescaped )
throws IOException {
    int index;
    char ch;
    int length = text.length();
    if ( preserveSpace ) {
        // Preserving spaces: the text must print exactly as it is,
        // without breaking when spaces appear in the text and without
        // consolidating spaces. If a line terminator is used, a line
        // break will occur.
        for ( index = 0 ; index < length ; ++index ) {
            ch = text.charAt( index );
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if (++index <length) {
                    surrogates(ch, text.charAt(index), true);
                } else {
                    fatalError("The character '"+ch+"' is an invalid XML character");
                }
                continue;
            }
            if ( unescaped  && XML11Char.isXML11ValidLiteral(ch)) {
                _printer.printText( ch );
            }
            else {
                printXMLChar( ch );
            }
        }
    }
    else {
        // Not preserving spaces: print one part at a time, and
        // use spaces between parts to break them into different
        // lines. Spaces at beginning of line will be stripped
        // by printing mechanism. Line terminator is treated
        // no different than other text part.
        for ( index = 0 ; index < length ; ++index ) {
            ch = text.charAt( index );
            if (!XML11Char.isXML11Valid(ch)) {
                // check if it is surrogate
                if (++index <length) {
                    surrogates(ch, text.charAt(index), true);
                } else {
                    fatalError("The character '"+ch+"' is an invalid XML character");
                }
                continue;
            }

            if ( unescaped && XML11Char.isXML11ValidLiteral(ch) ) {
                _printer.printText( ch );
            }
            else {
                printXMLChar( ch );
            }
        }
    }
}
 
Example 20
Source File: XML11DocumentScannerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
protected boolean isInvalidLiteral(int value) {
    return (!XML11Char.isXML11ValidLiteral(value));
}