Class NmTokensAttribute

Direct Known Subclasses:
Element_enumset.Attr_default, IdRefsAttribute

public abstract class NmTokensAttribute extends TypedAttribute<List<String>>
Implements an Attribute of "NMTOKENS" type, which holds as its value a list of NMTOKEN tokens separated by blanks. See [XML 1.0], "3.3.1 Attribute Types" and production rule [8].

See AttributeValues.checkNmToken(String) and splitValues(String) for details of these definitions.

  • Constructor Details

  • Method Details

    • checkValue

      protected void checkValue(@Opt List<String> values) throws TdomAttributeSyntaxException
      Check routine for the validity of the attributes' intended value. Is a call-back, implemented by the sub-classes. Is called only here, by two constructors and the TypedAttribute.setValue(V) method. The value null means "absent" for #IMPLIED attributes and passes the test.
      Specified by:
      checkValue in class TypedAttribute<List<String>>
      Parameters:
      values - the value to test; maybe null.
      Throws:
      TdomAttributeSyntaxException - iff the value does not match the type of the XML attribute, including a forbidden Null.
    • getTypeString

      public String getTypeString()
      The definition text for the "type" of the attribute in the original DTD.
      Specified by:
      getTypeString in class TypedAttribute<List<String>>
    • mustBeNameToken

      protected boolean mustBeNameToken()
      Overridden by subclass.
      Returns:
      whether the stronger rule for Name (not NmToken) must be applied.
    • splitValues

      public static @Opt List<String> splitValues(@Opt String text)
      Used from extern as auxiliary method. The definition [XML 1.0] production rule [8] requires exactly one space (= character 0x20) between tokens, and tokens must be at least one character long. But this method accepts space, tab, newline, and return as separator.

      FIXME the current impl gives strange diagnosis for multiple adjacent separators, as in att="b⎵⎵⎵c".

    • encode

      public final void encode(EncodingOutputStream out, TypedExtension ext) throws IOException
      DOCME
      Specified by:
      encode in class TypedNode<TypedExtension>
      Throws:
      IOException
    • findSplit

      protected static List<String> findSplit(Attributes attrs, NamespaceName name)
      DOCME
    • getStringValue

      public final @Opt String getStringValue(@Opt List<String> v)
      Returns the textual representation of a possible attribute value (not null), as it would be contained literally in a possible XML text representation. Since the textual representation of a String is the string itself, this method is relevant for enumeration types only (Later: also for "entity" types, but these are not yet supported.)
      Specified by:
      getStringValue in class TypedAttribute<List<String>>
      Returns:
      (never null) the textual representation of this attribute value, as it would be contained literally in a possible XML text representation.