Class RestrictedStringValue

All Implemented Interfaces:
Serializable, Expression, Item, ValueRepresentation

public final class RestrictedStringValue extends StringValue
A value conforming to one of the built-in subtypes of String, specifically normalizedString, token, language, Name, NCName, ID, IDREF, ENTITY, NMTOKEN. This class doesnt' handle the types derived by list: IDREFS, NMTOKENS, ENTITIES.
See Also:
  • Constructor Details

    • RestrictedStringValue

      public RestrictedStringValue()
  • Method Details

    • makeRestrictedString

      public static AtomicValue makeRestrictedString(CharSequence value, int type, NameChecker checker)
      Factory method to create a restricted string value from a string
      Parameters:
      value - the String value. Null is taken as equivalent to "".
      checker - a NameChecker if validation is required, null if the caller already knows that the value is valid
      Returns:
      either the required RestrictedStringValue if the value is valid, or an ErrorValue encapsulating the error message if not.
    • getItemType

      public ItemType getItemType(TypeHierarchy th)
      Return the type of the expression
      Specified by:
      getItemType in interface Expression
      Overrides:
      getItemType in class StringValue
      Parameters:
      th -
      Returns:
      Type.STRING (always)
    • convertPrimitive

      public AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
      Convert to target data type
      Overrides:
      convertPrimitive in class StringValue
      Parameters:
      requiredType - an integer identifying the required atomic type
      validate - true if validation is required. If set to false, the caller guarantees that the value is valid for the target data type, and that further validation is therefore not required. Note that a validation failure may be reported even if validation was not requested.
      context -
      Returns:
      an AtomicValue, a value of the required type; or an ErrorValue
    • toString

      public String toString()
      Description copied from class: AtomicValue
      Get string value. In general toString() for an atomic value displays the value as it would be written in XPath: that is, as a literal if available, or as a call on a constructor function otherwise.
      Overrides:
      toString in class StringValue