Class SerializationParameters

java.lang.Object
org.rumbledb.serialization.SerializationParameters
All Implemented Interfaces:
Serializable

public class SerializationParameters extends Object implements Serializable
Serialization parameters with the fixed fn:serialize map defaults from F&O 3.1. RumbleDB also uses these defaults for fn:serialize with omitted or XML parameters. Field initializers apply to every new instance; mutable collections belong to that instance. Application output defaults are selected separately by defaults(String).
See Also:
  • F&O 3.1 fn:serialize Specification references:
    • XQuery 3.1 Static Context Components — default serialization parameters (link: https://www.w3.org/TR/xquery-31/#id-xq-static-context-components)
    • XSLT and XQuery Serialization 3.1 — Serialization Parameters (link: https://www.w3.org/TR/xslt-xquery-serialization-31/#serparam)
  • Serialized Form
  • Constructor Details

    • SerializationParameters

      public SerializationParameters()
  • Method Details

    • setMethod

      public void setMethod(String method)
    • applyLanguageDefaults

      public void applyLanguageDefaults(String queryLanguage)
      Reapplies language defaults when parsing detects a different language; explicit options are preserved.
    • defaults

      public static SerializationParameters defaults()
    • defaults

      public static SerializationParameters defaults(String queryLanguage)
      Application output defaults. JSONiq uses the hybrid method and XQuery uses XML. Both leave item-separator absent so sequence normalization supplies atomic-value spaces. fn:serialize uses the standard field defaults through the no-argument constructor instead.
    • getMethod

      public String getMethod()
      Returns the method name, accepting the equivalent Q{}name spelling for standard methods.
    • getMediaType

      public String getMediaType()
      An explicit media type takes precedence. Otherwise choose a suitable type for the current method, so overriding the method never leaves a stale default media type behind.
    • getOmitXmlDeclaration

      public boolean getOmitXmlDeclaration()
    • getUndeclarePrefixes

      public boolean getUndeclarePrefixes()
    • getIncludeContentType

      public boolean getIncludeContentType()
    • getEscapeUriAttributes

      public boolean getEscapeUriAttributes()
    • getRequestedHtmlVersion

      public String getRequestedHtmlVersion()
      Requested HTML version for the HTML/XHTML output methods. Per XSLT and XQuery Serialization 3.1, the requested HTML version is the value of html-version when that parameter is present; otherwise it falls back to version.
      Returns:
      the requested HTML version, or null if neither parameter is set
    • isRequestedHtml5Version

      public boolean isRequestedHtml5Version()
      Whether the requested HTML version denotes HTML5. This check is intentionally narrow: we recognize the specific lexical forms that should trigger the HTML5 branch (5 and 5.0) without treating arbitrary version strings as decimals.
      Returns:
      true if the requested HTML version is "5" or "5.0"
    • getByteOrderMark

      public boolean getByteOrderMark()
    • getIndent

      public boolean getIndent()
    • getAllowDuplicateNames

      public boolean getAllowDuplicateNames()
    • copy

      public static SerializationParameters copy(SerializationParameters parameters)
      Returns a copy of the SerializationParameters instance.
      Parameters:
      parameters - the SerializationParameters instance to copy
      Returns:
      a copy of the SerializationParameters instance