invalid-characters

removing invalid XML characters from a string in java

谁都会走 提交于 2019-11-26 16:04:17
Hi i would like to remove all invalid XML characters from a string. i would like to use a regular expression with the string.replace method. like line.replace(regExp,""); what is the right regExp to use ? invalid XML character is everything that is not this : [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] thanks. Java's regex supports supplementary characters , so you can specify those high ranges with two UTF-16 encoded chars. Here is the pattern for removing characters that are illegal in XML 1.0 : // XML 1.0 // #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

Valid characters in a Java class name

a 夏天 提交于 2019-11-26 10:35:12
What characters are valid in a Java class name? What other rules govern Java class names (for instance, Java class names cannot begin with a number)? Jason Cohen You can have almost any character, including most Unicode characters! The exact definition is in the Java Language Specification under section 3.8: Identifiers . An identifier is an unlimited-length sequence of Java letters and Java digits , the first of which must be a Java letter . ... Letters and digits may be drawn from the entire Unicode character set, ... This allows programmers to use identifiers in their programs that are

Valid characters in a Java class name

不打扰是莪最后的温柔 提交于 2019-11-26 02:11:31
问题 What characters are valid in a Java class name? What other rules govern Java class names (for instance, Java class names cannot begin with a number)? 回答1: You can have almost any character, including most Unicode characters! The exact definition is in the Java Language Specification under section 3.8: Identifiers. An identifier is an unlimited-length sequence of Java letters and Java digits , the first of which must be a Java letter . ... Letters and digits may be drawn from the entire