Merge: Misc AST
[nit.git] / lib / sax / ext / decl_handler.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
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
9 # another product.
10
11 # SAX2 extension handler for DTD declaration events.
12 module sax::ext::decl_handler
13
14 # SAX2 extension handler for DTD declaration events.
15 #
16 # This is an optional extension handler for SAX2 to provide more
17 # complete information about DTD declarations in an XML document.
18 # XML readers are not required to recognize this handler, and it
19 # is not part of core-only SAX2 distributions.
20 #
21 # Note that data-related DTD declarations (unparsed entities and
22 # notations) are already reported through the `DTDHandler` interface.
23 #
24 # If you are using the declaration handler together with a lexical
25 # handler, all of the events will occur between the `start_dtd` and the
26 # `end_dtd` events.
27 #
28 # To set the `DeclHandler` for an XML reader, use the
29 # `set_property` method with the property name
30 # `http://xml.org/sax/properties/declaration-handler`
31 # and an object implementing this interface (or `null`) as the value.
32 abstract class DeclHandler
33 # Report an element type declaration.
34 #
35 # The content model will consist of the string `EMPTY`, the
36 # string `ANY`, or a parenthesised group, optionally followed
37 # by an occurrence indicator. The model will be normalized so
38 # that all parameter entities are fully resolved and all whitespace
39 # is removed,and will include the enclosing parentheses. Other
40 # normalization (such as removing redundant parentheses or
41 # simplifying occurrence indicators) is at the discretion of the
42 # parser.
43 #
44 # Parameters:
45 #
46 # * `name`: element type name.
47 # * `model`: content model as a normalized string.
48 fun element_decl(name: String, model: String) do end
49
50 # Report an attribute type declaration.
51 #
52 # Only the effective (first) declaration for an attribute will
53 # be reported. The type will be one of the strings `CDATA`,
54 # `ID`, `IDREF`, `IDREFS`, `NMTOKEN`, `NMTOKENS`, `ENTITY`,
55 # `ENTITIES`, a parenthesized token group with
56 # the separator `|` and all whitespace removed, or the word
57 # `NOTATION` followed by a space followed by a parenthesized
58 # token group with all whitespace removed.
59 #
60 # The value will be the value as reported to applications,
61 # appropriately normalized and with entity and character
62 # references expanded.
63 #
64 # Parameters:
65 #
66 # * `element_name`: name of the associated element.
67 # * `attribute_name`: name of the attribute.
68 # * `attribute_type`: string representing the attribute type.
69 # * `mode`: string representing the attribute defaulting mode (`#IMPLIED`,
70 # `#REQUIRED`, or `#FIXED`) or `null` if none of these applies.
71 # * `value`: string representing the attribute's default value,
72 # or `null` if there is none.
73 fun attribute_decl(element_name: String,
74 attribute_name: String,
75 attribute_type: String,
76 mode: nullable String,
77 value: nullable String) do end
78
79 # Report an internal entity declaration.
80 #
81 # Only the effective (first) declaration for each entity
82 # will be reported. All parameter entities in the value
83 # will be expanded, but general entities will not.
84 #
85 # Parameters:
86 #
87 # * `name`: name of the entity. If it is a parameter entity, the name will
88 # begin with `%`.
89 # * `value`: replacement text of the entity.
90 #
91 # SEE: `external_entity_decl`
92 #
93 # SEE: `sax::DTDHandler.unparsed_entity_decl`
94 fun internal_entity_decl(name: String, value: String) do end
95
96 # Report a parsed external entity declaration.
97 #
98 # Only the effective (first) declaration for each entity
99 # will be reported.
100 #
101 # Parameters:
102 #
103 # * `name`: name of the entity. If it is a parameter entity, the name will
104 # begin with `%`.
105 # * `public_id`: declared public identifier of the entity, or `null` if
106 # none was declared.
107 # * `system_id`: declared system identifier of the entity.
108 #
109 # SEE: `internal_entity_decl`
110 #
111 # SEE: `sax::DTDHandler.unparsed_entity_decl`
112 fun external_entity_decl(name: String, value: String) do end
113 end