com.sun.org.apache.xerces.internal.util.XML11Char Java Examples
The following examples show how to use
com.sun.org.apache.xerces.internal.util.XML11Char.
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 TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected final void printXMLChar( int ch ) throws IOException { if (ch == '\r' || ch == 0x0085 || ch == 0x2028) { printHex(ch); } else if ( ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '>'){ // character sequence "]]>" can't appear in content, therefore // we should escape '>' _printer.printText(">"); } else if ( _encodingInfo.isPrintable((char)ch) && XML11Char.isXML11ValidLiteral(ch)) { _printer.printText((char)ch); } else { printHex(ch); } }
Example #2
Source File: CoreDocumentImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Checks if the given qualified name is legal with respect * to the version of XML to which this document must conform. * * @param prefix prefix of qualified name * @param local local part of qualified name */ public static final boolean isValidQName(String prefix, String local, boolean xml11Version) { // check that both prefix and local part match NCName if (local == null) return false; boolean validNCName = false; if (!xml11Version) { validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) && XMLChar.isValidNCName(local); } else { validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix)) && XML11Char.isXML11ValidNCName(local); } return validNCName; }
Example #3
Source File: XML11Serializer.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected final void printXMLChar( int ch ) throws IOException { if (ch == '\r' || ch == 0x0085 || ch == 0x2028) { printHex(ch); } else if ( ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '>'){ // character sequence "]]>" can't appear in content, therefore // we should escape '>' _printer.printText(">"); } else if ( _encodingInfo.isPrintable((char)ch) && XML11Char.isXML11ValidLiteral(ch)) { _printer.printText((char)ch); } else { printHex(ch); } }
Example #4
Source File: XML11Serializer.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected final void printXMLChar( int ch ) throws IOException { if (ch == '\r' || ch == 0x0085 || ch == 0x2028) { printHex(ch); } else if ( ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '>'){ // character sequence "]]>" can't appear in content, therefore // we should escape '>' _printer.printText(">"); } else if ( _encodingInfo.isPrintable((char)ch) && XML11Char.isXML11ValidLiteral(ch)) { _printer.printText((char)ch); } else { printHex(ch); } }
Example #5
Source File: XML11IDDatatypeValidator.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Checks that "content" string is valid ID value. * If invalid a Datatype validation exception is thrown. * * @param content the string value that needs to be validated * @param context the validation context * @throws InvalidDatatypeException if the content is * invalid according to the rules for the validators * @see InvalidDatatypeValueException */ public void validate(String content, ValidationContext context) throws InvalidDatatypeValueException { //Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* if(context.useNamespaces()) { if (!XML11Char.isXML11ValidNCName(content)) { throw new InvalidDatatypeValueException("IDInvalidWithNamespaces", new Object[]{content}); } } else { if (!XML11Char.isXML11ValidName(content)) { throw new InvalidDatatypeValueException("IDInvalid", new Object[]{content}); } } if (context.isIdDeclared(content)) { throw new InvalidDatatypeValueException("IDNotUnique", new Object[]{content}); } context.addId(content); }
Example #6
Source File: XML11IDDatatypeValidator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Checks that "content" string is valid ID value. * If invalid a Datatype validation exception is thrown. * * @param content the string value that needs to be validated * @param context the validation context * @throws InvalidDatatypeException if the content is * invalid according to the rules for the validators * @see InvalidDatatypeValueException */ public void validate(String content, ValidationContext context) throws InvalidDatatypeValueException { //Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* if(context.useNamespaces()) { if (!XML11Char.isXML11ValidNCName(content)) { throw new InvalidDatatypeValueException("IDInvalidWithNamespaces", new Object[]{content}); } } else { if (!XML11Char.isXML11ValidName(content)) { throw new InvalidDatatypeValueException("IDInvalid", new Object[]{content}); } } if (context.isIdDeclared(content)) { throw new InvalidDatatypeValueException("IDNotUnique", new Object[]{content}); } context.addId(content); }
Example #7
Source File: CoreDocumentImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Checks if the given qualified name is legal with respect * to the version of XML to which this document must conform. * * @param prefix prefix of qualified name * @param local local part of qualified name */ public static final boolean isValidQName(String prefix, String local, boolean xml11Version) { // check that both prefix and local part match NCName if (local == null) return false; boolean validNCName = false; if (!xml11Version) { validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) && XMLChar.isValidNCName(local); } else { validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix)) && XML11Char.isXML11ValidNCName(local); } return validNCName; }
Example #8
Source File: DOM3TreeWalker.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Taken from org.apache.xerces.dom.CoreDocumentImpl * * Checks if the given qualified name is legal with respect * to the version of XML to which this document must conform. * * @param prefix prefix of qualified name * @param local local part of qualified name */ protected boolean isValidQName( String prefix, String local, boolean xml11Version) { // check that both prefix and local part match NCName if (local == null) return false; boolean validNCName = false; if (!xml11Version) { validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) && XMLChar.isValidNCName(local); } else { validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix)) && XML11Char.isXML11ValidNCName(local); } return validNCName; }
Example #9
Source File: CoreDocumentImpl.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Checks if the given qualified name is legal with respect * to the version of XML to which this document must conform. * * @param prefix prefix of qualified name * @param local local part of qualified name */ public static final boolean isValidQName(String prefix, String local, boolean xml11Version) { // check that both prefix and local part match NCName if (local == null) return false; boolean validNCName = false; if (!xml11Version) { validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) && XMLChar.isValidNCName(local); } else { validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix)) && XML11Char.isXML11ValidNCName(local); } return validNCName; }
Example #10
Source File: XML11IDREFDatatypeValidator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Checks that "content" string is valid IDREF value. * If invalid a Datatype validation exception is thrown. * * @param content the string value that needs to be validated * @param context the validation context * @throws InvalidDatatypeException if the content is * invalid according to the rules for the validators * @see InvalidDatatypeValueException */ public void validate(String content, ValidationContext context) throws InvalidDatatypeValueException { //Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* if(context.useNamespaces()) { if (!XML11Char.isXML11ValidNCName(content)) { throw new InvalidDatatypeValueException("IDREFInvalidWithNamespaces", new Object[]{content}); } } else { if (!XML11Char.isXML11ValidName(content)) { throw new InvalidDatatypeValueException("IDREFInvalid", new Object[]{content}); } } context.addIdRef(content); }
Example #11
Source File: XML11IDDatatypeValidator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Checks that "content" string is valid ID value. * If invalid a Datatype validation exception is thrown. * * @param content the string value that needs to be validated * @param context the validation context * @throws InvalidDatatypeException if the content is * invalid according to the rules for the validators * @see InvalidDatatypeValueException */ public void validate(String content, ValidationContext context) throws InvalidDatatypeValueException { //Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* if(context.useNamespaces()) { if (!XML11Char.isXML11ValidNCName(content)) { throw new InvalidDatatypeValueException("IDInvalidWithNamespaces", new Object[]{content}); } } else { if (!XML11Char.isXML11ValidName(content)) { throw new InvalidDatatypeValueException("IDInvalid", new Object[]{content}); } } if (context.isIdDeclared(content)) { throw new InvalidDatatypeValueException("IDNotUnique", new Object[]{content}); } context.addId(content); }
Example #12
Source File: XML11IDDatatypeValidator.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Checks that "content" string is valid ID value. * If invalid a Datatype validation exception is thrown. * * @param content the string value that needs to be validated * @param context the validation context * @throws InvalidDatatypeException if the content is * invalid according to the rules for the validators * @see InvalidDatatypeValueException */ public void validate(String content, ValidationContext context) throws InvalidDatatypeValueException { //Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* if(context.useNamespaces()) { if (!XML11Char.isXML11ValidNCName(content)) { throw new InvalidDatatypeValueException("IDInvalidWithNamespaces", new Object[]{content}); } } else { if (!XML11Char.isXML11ValidName(content)) { throw new InvalidDatatypeValueException("IDInvalid", new Object[]{content}); } } if (context.isIdDeclared(content)) { throw new InvalidDatatypeValueException("IDNotUnique", new Object[]{content}); } context.addId(content); }
Example #13
Source File: CoreDocumentImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Checks if the given qualified name is legal with respect * to the version of XML to which this document must conform. * * @param prefix prefix of qualified name * @param local local part of qualified name */ public static final boolean isValidQName(String prefix, String local, boolean xml11Version) { // check that both prefix and local part match NCName if (local == null) return false; boolean validNCName = false; if (!xml11Version) { validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) && XMLChar.isValidNCName(local); } else { validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix)) && XML11Char.isXML11ValidNCName(local); } return validNCName; }
Example #14
Source File: CoreDocumentImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Check the string against XML's definition of acceptable names for * elements and attributes and so on using the XMLCharacterProperties * utility class */ public static final boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if(!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
Example #15
Source File: XML11Serializer.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected final void surrogates(int high, int low) throws IOException{ if (XMLChar.isHighSurrogate(high)) { if (!XMLChar.isLowSurrogate(low)) { //Invalid XML fatalError("The character '"+(char)low+"' is an invalid XML character"); } else { int supplemental = XMLChar.supplemental((char)high, (char)low); if (!XML11Char.isXML11Valid(supplemental)) { //Invalid XML fatalError("The character '"+(char)supplemental+"' is an invalid XML character"); } else { if (content().inCData ) { _printer.printText("]]>&#x"); _printer.printText(Integer.toHexString(supplemental)); _printer.printText(";<![CDATA["); } else { printHex(supplemental); } } } } else { fatalError("The character '"+(char)high+"' is an invalid XML character"); } }
Example #16
Source File: XML11Serializer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected final void surrogates(int high, int low) throws IOException{ if (XMLChar.isHighSurrogate(high)) { if (!XMLChar.isLowSurrogate(low)) { //Invalid XML fatalError("The character '"+(char)low+"' is an invalid XML character"); } else { int supplemental = XMLChar.supplemental((char)high, (char)low); if (!XML11Char.isXML11Valid(supplemental)) { //Invalid XML fatalError("The character '"+(char)supplemental+"' is an invalid XML character"); } else { if (content().inCData ) { _printer.printText("]]>&#x"); _printer.printText(Integer.toHexString(supplemental)); _printer.printText(";<![CDATA["); } else { printHex(supplemental); } } } } else { fatalError("The character '"+(char)high+"' is an invalid XML character"); } }
Example #17
Source File: XML11Serializer.java From JDKSourceCode1.8 with MIT License | 5 votes |
protected final void surrogates(int high, int low) throws IOException{ if (XMLChar.isHighSurrogate(high)) { if (!XMLChar.isLowSurrogate(low)) { //Invalid XML fatalError("The character '"+(char)low+"' is an invalid XML character"); } else { int supplemental = XMLChar.supplemental((char)high, (char)low); if (!XML11Char.isXML11Valid(supplemental)) { //Invalid XML fatalError("The character '"+(char)supplemental+"' is an invalid XML character"); } else { if (content().inCData ) { _printer.printText("]]>&#x"); _printer.printText(Integer.toHexString(supplemental)); _printer.printText(";<![CDATA["); } else { printHex(supplemental); } } } } else { fatalError("The character '"+(char)high+"' is an invalid XML character"); } }
Example #18
Source File: CoreDocumentImpl.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Check the string against XML's definition of acceptable names for * elements and attributes and so on using the XMLCharacterProperties * utility class */ public static final boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if(!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
Example #19
Source File: DOM3TreeWalker.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Taken from org.apache.xerces.dom.CoreDocumentImpl * * Check the string against XML's definition of acceptable names for * elements and attributes and so on using the XMLCharacterProperties * utility class */ protected boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if (!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
Example #20
Source File: CoreDocumentImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Check the string against XML's definition of acceptable names for * elements and attributes and so on using the XMLCharacterProperties * utility class */ public static final boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if(!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
Example #21
Source File: XML11Serializer.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
protected void printEscaped( String source ) throws IOException { int length = source.length(); for ( int i = 0 ; i < length ; ++i ) { int ch = source.charAt(i); if (!XML11Char.isXML11Valid(ch)) { if (++i <length) { surrogates(ch, source.charAt(i)); } else { fatalError("The character '"+(char)ch+"' is an invalid XML character"); } continue; } if (ch == '\n' || ch == '\r' || ch == '\t' || ch == 0x0085 || ch == 0x2028){ printHex(ch); } else if (ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '"') { _printer.printText("""); } else if ((ch >= ' ' && _encodingInfo.isPrintable((char) ch))) { _printer.printText((char) ch); } else { printHex(ch); } } }
Example #22
Source File: CoreDocumentImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Check the string against XML's definition of acceptable names for * elements and attributes and so on using the XMLCharacterProperties * utility class */ public static final boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if(!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
Example #23
Source File: XML11Serializer.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
protected final void surrogates(int high, int low) throws IOException{ if (XMLChar.isHighSurrogate(high)) { if (!XMLChar.isLowSurrogate(low)) { //Invalid XML fatalError("The character '"+(char)low+"' is an invalid XML character"); } else { int supplemental = XMLChar.supplemental((char)high, (char)low); if (!XML11Char.isXML11Valid(supplemental)) { //Invalid XML fatalError("The character '"+(char)supplemental+"' is an invalid XML character"); } else { if (content().inCData ) { _printer.printText("]]>&#x"); _printer.printText(Integer.toHexString(supplemental)); _printer.printText(";<![CDATA["); } else { printHex(supplemental); } } } } else { fatalError("The character '"+(char)high+"' is an invalid XML character"); } }
Example #24
Source File: CoreDocumentImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Check the string against XML's definition of acceptable names for * elements and attributes and so on using the XMLCharacterProperties * utility class */ public static final boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if(!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
Example #25
Source File: CoreDocumentImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Check the string against XML's definition of acceptable names for * elements and attributes and so on using the XMLCharacterProperties * utility class */ public static final boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if(!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
Example #26
Source File: XML11Serializer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected final void surrogates(int high, int low, boolean inContent) throws IOException{ if (XMLChar.isHighSurrogate(high)) { if (!XMLChar.isLowSurrogate(low)) { //Invalid XML fatalError("The character '"+(char)low+"' is an invalid XML character"); } else { int supplemental = XMLChar.supplemental((char)high, (char)low); if (!XML11Char.isXML11Valid(supplemental)) { //Invalid XML fatalError("The character '"+(char)supplemental+"' is an invalid XML character"); } else { if (inContent && content().inCData) { _printer.printText("]]>&#x"); _printer.printText(Integer.toHexString(supplemental)); _printer.printText(";<![CDATA["); } else { printHex(supplemental); } } } } else { fatalError("The character '"+(char)high+"' is an invalid XML character"); } }
Example #27
Source File: CoreDocumentImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Check the string against XML's definition of acceptable names for * elements and attributes and so on using the XMLCharacterProperties * utility class */ public static final boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if(!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
Example #28
Source File: XML11Serializer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected void printEscaped( String source ) throws IOException { int length = source.length(); for ( int i = 0 ; i < length ; ++i ) { int ch = source.charAt(i); if (!XML11Char.isXML11Valid(ch)) { if (++i <length) { surrogates(ch, source.charAt(i), false); } else { fatalError("The character '"+(char)ch+"' is an invalid XML character"); } continue; } if (ch == '\n' || ch == '\r' || ch == '\t' || ch == 0x0085 || ch == 0x2028) { printHex(ch); } else if (ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '"') { _printer.printText("""); } else if ((ch >= ' ' && _encodingInfo.isPrintable((char) ch))) { _printer.printText((char) ch); } else { printHex(ch); } } }
Example #29
Source File: XML11DocumentScannerImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
protected boolean isInvalid(int value) { return (XML11Char.isXML11Invalid(value)); }
Example #30
Source File: XML11DTDScannerImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
protected boolean isValidNCName(int value) { return (XML11Char.isXML11NCName(value)); }