Class RestrictedStringValue

  • All Implemented Interfaces:
    java.io.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:
    Serialized Form
    • Constructor Detail

      • RestrictedStringValue

        public RestrictedStringValue()
    • Method Detail

      • makeRestrictedString

        public static AtomicValue makeRestrictedString​(java.lang.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.
      • 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
        context -
        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.
        Returns:
        an AtomicValue, a value of the required type; or an ErrorValue
      • toString

        public java.lang.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