Class XMLUtil

java.lang.Object
org.xbib.content.xml.util.XMLUtil

public final class XMLUtil extends Object
  • Method Details

    • escape

      public static CharSequence escape(CharSequence string)
      Replace special characters with XML escapes.
       & (ampersand) is replaced by &
       < (less than) is replaced by &lt;
       > (greater than) is replaced by &gt;
       " (double quote) is replaced by &quot;
       
      Parameters:
      string - The string to be escaped.
      Returns:
      The escaped string.
    • escape

      public static CharSequence escape(char[] chars, int start, int len)
    • escape

      public static void escape(StringBuilder sb, String string)
    • escape

      public static void escape(StringBuilder sb, CharSequence string)
    • escape

      public static void escape(StringBuilder sb, char[] chars, int start, int len)
    • unescape

      public static String unescape(String str)
    • sanitize

      public static String sanitize(CharSequence string)
      Clean strings from illegal XML 1.0 characters. See XML charset
      Parameters:
      string - string to clean
      Returns:
      the cleaned string
    • sanitizeToLineFeed

      public static String sanitizeToLineFeed(CharSequence string)
    • sanitizeXml10

      public static String sanitizeXml10(CharSequence sequence)
      The pattern matching does not work.
      Parameters:
      sequence - the character sequence
      Returns:
      sanitized string
    • sanitizeXml10

      public static String sanitizeXml10(char[] sequence, int offset, int length)
    • sanitizeXml11

      public static String sanitizeXml11(CharSequence sequence)
    • sanitizeXml11

      public static String sanitizeXml11(char[] sequence, int offset, int length)
    • isNCName

      public static boolean isNCName(CharSequence name)
      Checks whether the supplied String is an NCName (Namespace Classified Name) as specified at http://www.w3.org/TR/REC-xml-names/#NT-NCName.
      Parameters:
      name - the string
      Returns:
      true if string is a namespace classified name
    • isNCNameChar

      public static boolean isNCNameChar(char c)
    • isLetter

      public static boolean isLetter(char c)
    • isIdeographic

      public static boolean isIdeographic(char c)
    • isCombiningChar

      public static boolean isCombiningChar(char c)
    • isDigit

      public static boolean isDigit(char c)
    • isExtender

      public static boolean isExtender(char c)