1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # This file is free software, which comes along with NIT. This software is
4 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
5 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
6 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
7 # is kept unaltered, and a notification of the changes is added.
8 # You are allowed to redistribute it and sell it, alone or is a part of
11 # Interface for a list of XML attributes.
12 module sax
::attributes
14 # Interface for a list of XML attributes.
16 # This interface allows access to a list of attributes in
17 # three different ways:
19 # * by attribute index;
20 # * by Namespace-qualified name; or
21 # * by qualified (prefixed) name.
23 # The list will not contain attributes that were declared
24 # `#IMPLIED` but not specified in the start tag. It will also not
25 # contain attributes used as Namespace declarations (`xmlns*`) unless
26 # the `http://xml.org/sax/features/namespace-prefixes`
27 # feature is set to `true` (it is `false` by default).
28 # Because SAX2 conforms to the "Namespaces in XML" specification,
29 # it does not give namespace declaration attributes a namespace URI.
30 # Some other W3C specifications are in conflict with that, expecting
31 # these declarations to be in a namespace.
32 # Handler code may need to resolve that conflict.
34 # If the namespace-prefixes feature (see above) is `false`,
35 # access by qualified name may not be available; if the
36 # `http://xml.org/sax/features/namespaces`
37 # feature is `false`, access by Namespace-qualified names
38 # may not be available.
40 # The order of attributes in the list is unspecified, and will
41 # vary from implementation to implementation.
43 # Note: The original documentation comes from [SAX 2.0](http://www.saxproject.org).
45 # SEE: `sax::helpers::AttributesImpl`
47 # SEE: `sax::ext::DeclHandler.attribute_decl`
50 # Return the number of attributes in the list.
51 fun length
: Int is abstract
53 # Look up an attribute's Namespace URI by index.
57 # * `index`: attribute index.
61 # The Namespace URI, or the empty string if none
62 # is available, or `null` if the index is out of
66 fun uri
(index
: Int): nullable String is abstract
68 # Look up an attribute's local name by index.
72 # * `index`: attribute index.
76 # The local name, or the empty string if Namespace
77 # processing is not being performed, or `null`
78 # if the index is out of range.
81 fun local_name
(index
: Int): nullable String is abstract
83 # Look up an attribute's XML 1.0 qualified name by index.
87 # * `index`: attribute index.
91 # The XML 1.0 qualified name, or the empty string
92 # if none is available, or `null` if the index
96 fun qname
(index
: Int): nullable String is abstract
98 # Look up an attribute's type by index.
100 # The attribute type is one of the strings `CDATA`, `ID`,
101 # `IDREF`, `IDREFS`, `NMTOKEN`, `NMTOKENS`, `ENTITY`, `ENTITIES`,
102 # or `NOTATION` (always in upper case).
104 # If the parser has not read a declaration for the attribute,
105 # or if the parser does not report attribute types, then it must
106 # return the value `CDATA` as stated in the XML 1.0 Recommentation
107 # (clause 3.3.3, "Attribute-Value Normalization").
109 # For an enumerated attribute that is not a notation, the
110 # parser will report the type as `NMTOKEN`.
114 # * `index: Int`: attribute index.
115 # * `index: String`: XML 1.0 qualified (prefixed) name.
119 # The attribute's type as a string, or `null` if the specified
120 # attribute is not in the list or if qualified names
124 fun type_of
(index
: Object): nullable String is abstract
126 # Look up an attribute's value by index.
128 # If the attribute value is a list of tokens (`IDREFS`,
129 # `ENTITIES`, or `NMTOKENS`), the tokens will be concatenated
130 # into a single string with each token separated by a
135 # * `index: Int`: attribute index.
136 # * `index: String`: XML 1.0 qualified (prefixed) name.
140 # The attribute's value as a string, or `null` if the specified
141 # attribute is not in the list or if qualified names
145 fun value_of
(index
: Object): nullable String is abstract
147 # Look up the index of an attribute by Namespace name.
151 # * `uri`: Namespace URI, or the empty string if
152 # the name has no Namespace URI.
153 # * `local_name`: attribute's local name.
157 # The index of the attribute, or -1 if it does not
158 # appear in the list.
159 fun index_ns
(uri
: String, local_name
: String): Int is abstract
161 # Look up the index of an attribute by XML 1.0 qualified name.
165 # * `qname`: XML 1.0 qualified (prefixed) name.
169 # The index of the attribute, or -1 if it does not
170 # appear in the list.
171 fun index_of
(qname
: String): Int is abstract
173 # Look up an attribute's type by Namespace name.
175 # See `type_of` for a description
176 # of the possible types.
180 # * `uri`: Namespace URI, or the empty string if
181 # the name has no Namespace URI.
183 # * `local_name`: attribute's local name.
187 # The attribute type as a string, or `null` if the
188 # attribute is not in the list or if Namespace
189 # processing is not being performed.
190 fun type_ns
(uri
: String, local_name
: String): nullable String is abstract
192 # Look up an attribute's value by Namespace name.
194 # See `value_of` for a description
195 # of the possible values.
199 # * `uri`: Namespace URI, or the empty string if
200 # the name has no Namespace URI.
202 # * `local_name`: attribute's local name.
206 # The attribute value as a string, or `null` if the
207 # attribute is not in the list or if Namespace
208 # processing is not being performed.
209 fun value_ns
(uri
: String, local_name
: String): nullable String is abstract