Enum Class WhitespaceFacet

java.lang.Object
java.lang.Enum<WhitespaceFacet>
org.rumbledb.types.WhitespaceFacet
All Implemented Interfaces:
Serializable, Comparable<WhitespaceFacet>, Constable

public enum WhitespaceFacet extends Enum<WhitespaceFacet>
Represents the three legal values of the whiteSpace constraining facet as defined in XSD 1.1 Part 2, Section 4.3.6.
"whiteSpace constrains the value space of types derived from string such that the various behaviors specified in Attribute Value Normalization in XML are realized. The value of whiteSpace must be one of {preserve, replace, collapse}."
  • PRESERVE โ€“ "No normalization is done, the value is not changed (this is the behavior required by XML for element content)"
  • REPLACE โ€“ "All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return) are replaced with #x20 (space)"
  • COLLAPSE โ€“ "After the processing implied by replace, contiguous sequences of #x20's are collapsed to a single #x20, and any #x20 at the start or end of the string is then removed."

Applicability rules from the spec:

"whiteSpace is applicable to all atomic and list datatypes. For all atomic datatypes other than string (and types derived by facet-based restriction from it) the value of whiteSpace is collapse and cannot be changed by a schema author; for string the value of whiteSpace is preserve; for any type derived by facet-based restriction from string the value of whiteSpace can be any of the three legal values (as long as the value is at least as restrictive as the value of the base type)."

The enum constants are declared in restriction order (PRESERVE < REPLACE < COLLAPSE) so that Enum.ordinal() comparisons correctly enforce the constraint that a derived type may only make the facet more restrictive, never less.

See Also:
  • Enum Constant Details

  • Method Details

    • values

      public static WhitespaceFacet[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static WhitespaceFacet valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null