Package groovy.xml

# Class MarkupBuilder.DefaultXmlEscapingFunction

java.lang.Object
groovy.xml.MarkupBuilder.DefaultXmlEscapingFunction

All Implemented Interfaces:
  `Function<Character,Optional<String>>`

Enclosing class:
  MarkupBuilder

public static class MarkupBuilder.DefaultXmlEscapingFunction extends Object implements Function<Character,Optional<String>>
Default character replacement function used for XML content and attribute escaping.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultXmlEscapingFunction(boolean isAttrValue, boolean useDoubleQuotes)`
  Creates an escaping function for either element content or attribute values.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Optional<String>`
  `apply(Character ch)`
  Escapes a single character when required by XML output rules.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.util.function.Function

  `andThen, compose`

- ## Constructor Details

  - ### DefaultXmlEscapingFunction

    public DefaultXmlEscapingFunction(boolean isAttrValue, boolean useDoubleQuotes)
    Creates an escaping function for either element content or attribute values.
    Parameters:
      `isAttrValue` - whether the text being escaped is an attribute value
      `useDoubleQuotes` - whether attributes are quoted with double quotes

- ## Method Details

  - ### apply

    public Optional<String> apply(Character ch)
    Escapes a single character when required by XML output rules.
    Specified by:
      `apply` in interface `Function<Character,Optional<String>>`
    Parameters:
      `ch` - the character to inspect
    Returns:
      an escaped replacement, or `Optional.empty()` if no replacement is needed