Class XmlCharRefUtils

java.lang.Object
org.rumbledb.compiler.utils.XmlCharRefUtils

public final class XmlCharRefUtils extends Object
Utility for unescaping and validating XML character references and predefined entity references.

Enforces W3C XML 1.0 / 1.1 Char production and raises err:XQST0090 (CharacterReferenceException) if a character reference does not expand to a legal XML character or overflows integer range.

  • Method Details

    • unescapeXml

      public static String unescapeXml(String text, String xmlVersion, ExceptionMetadata metadata)
      Unescapes XML character references and predefined entity references in the given text using the specified XML version.
      Parameters:
      text - the input string to unescape
      xmlVersion - the XML version ("1.0" or "1.1")
      metadata - metadata for error reporting
      Returns:
      the unescaped string
      Throws:
      CharacterReferenceException - [err:XQST0090] if any character reference does not expand to a legal XML character