Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsISAXAttributes; |
michael@0 | 9 | |
michael@0 | 10 | /** |
michael@0 | 11 | * Receive notification of the logical content of a document. |
michael@0 | 12 | * |
michael@0 | 13 | * This is the main interface that most SAX applications implement: if |
michael@0 | 14 | * the application needs to be informed of basic parsing events, it |
michael@0 | 15 | * implements this interface and registers an instance with the SAX |
michael@0 | 16 | * parser. The parser uses the instance to report basic |
michael@0 | 17 | * document-related events like the start and end of elements and |
michael@0 | 18 | * character data. |
michael@0 | 19 | * |
michael@0 | 20 | * The order of events in this interface is very important, and |
michael@0 | 21 | * mirrors the order of information in the document itself. For |
michael@0 | 22 | * example, all of an element's content (character data, processing |
michael@0 | 23 | * instructions, and/or subelements) will appear, in order, between |
michael@0 | 24 | * the startElement event and the corresponding endElement event. |
michael@0 | 25 | */ |
michael@0 | 26 | [scriptable, uuid(2a99c757-dfee-4806-bff3-f721440412e0)] |
michael@0 | 27 | interface nsISAXContentHandler : nsISupports |
michael@0 | 28 | { |
michael@0 | 29 | /** |
michael@0 | 30 | * Receive notification of the beginning of a document. |
michael@0 | 31 | * |
michael@0 | 32 | * The SAX parser will invoke this method only once, before any |
michael@0 | 33 | * other event callbacks. |
michael@0 | 34 | */ |
michael@0 | 35 | void startDocument(); |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * Receive notification of the end of a document. |
michael@0 | 39 | * |
michael@0 | 40 | * There is an apparent contradiction between the documentation for |
michael@0 | 41 | * this method and the documentation for ErrorHandler.fatalError(). |
michael@0 | 42 | * Until this ambiguity is resolved in a future major release, |
michael@0 | 43 | * clients should make no assumptions about whether endDocument() |
michael@0 | 44 | * will or will not be invoked when the parser has reported a |
michael@0 | 45 | * fatalError() or thrown an exception. |
michael@0 | 46 | * |
michael@0 | 47 | * The SAX parser will invoke this method only once, and it will be |
michael@0 | 48 | * the last method invoked during the parse. The parser shall not |
michael@0 | 49 | * invoke this method until it has either abandoned parsing (because |
michael@0 | 50 | * of an unrecoverable error) or reached the end of input. |
michael@0 | 51 | */ |
michael@0 | 52 | void endDocument(); |
michael@0 | 53 | |
michael@0 | 54 | /** |
michael@0 | 55 | * Receive notification of the beginning of an element. |
michael@0 | 56 | * |
michael@0 | 57 | * The Parser will invoke this method at the beginning of every |
michael@0 | 58 | * element in the XML document; there will be a corresponding |
michael@0 | 59 | * endElement event for every startElement event (even when the |
michael@0 | 60 | * element is empty). All of the element's content will be reported, |
michael@0 | 61 | * in order, before the corresponding endElement event. |
michael@0 | 62 | * |
michael@0 | 63 | * This event allows up to three name components for each element: |
michael@0 | 64 | * |
michael@0 | 65 | * 1.) the Namespace URI; |
michael@0 | 66 | * 2.) the local name; and |
michael@0 | 67 | * 3.) the qualified (prefixed) name. |
michael@0 | 68 | * |
michael@0 | 69 | * Any or all of these may be provided, depending on the values of |
michael@0 | 70 | * the http://xml.org/sax/features/namespaces and the |
michael@0 | 71 | * http://xml.org/sax/features/namespace-prefixes properties: |
michael@0 | 72 | * |
michael@0 | 73 | * The Namespace URI and local name are required when the namespaces |
michael@0 | 74 | * property is true (the default), and are optional when the |
michael@0 | 75 | * namespaces property is false (if one is specified, both must be); |
michael@0 | 76 | * |
michael@0 | 77 | * The qualified name is required when the namespace-prefixes |
michael@0 | 78 | * property is true, and is optional when the namespace-prefixes |
michael@0 | 79 | * property is false (the default). |
michael@0 | 80 | * |
michael@0 | 81 | * Note that the attribute list provided will contain only |
michael@0 | 82 | * attributes with explicit values (specified or defaulted): |
michael@0 | 83 | * #IMPLIED attributes will be omitted. The attribute list will |
michael@0 | 84 | * contain attributes used for Namespace declarations (xmlns* |
michael@0 | 85 | * attributes) only if the |
michael@0 | 86 | * http://xml.org/sax/features/namespace-prefixes property is true |
michael@0 | 87 | * (it is false by default, and support for a true value is |
michael@0 | 88 | * optional). |
michael@0 | 89 | * |
michael@0 | 90 | * @param uri the Namespace URI, or the empty string if the |
michael@0 | 91 | * element has no Namespace URI or if Namespace |
michael@0 | 92 | * processing is not being performed |
michael@0 | 93 | * @param localName the local name (without prefix), or the |
michael@0 | 94 | * empty string if Namespace processing is not being |
michael@0 | 95 | * performed |
michael@0 | 96 | * @param qName the qualified name (with prefix), or the |
michael@0 | 97 | * empty string if qualified names are not available |
michael@0 | 98 | * @param atts the attributes attached to the element. If |
michael@0 | 99 | * there are no attributes, it shall be an empty |
michael@0 | 100 | * SAXAttributes object. The value of this object after |
michael@0 | 101 | * startElement returns is undefined |
michael@0 | 102 | */ |
michael@0 | 103 | void startElement(in AString uri, in AString localName, |
michael@0 | 104 | in AString qName, in nsISAXAttributes attributes); |
michael@0 | 105 | |
michael@0 | 106 | /** |
michael@0 | 107 | * Receive notification of the end of an element. |
michael@0 | 108 | * |
michael@0 | 109 | * The SAX parser will invoke this method at the end of every |
michael@0 | 110 | * element in the XML document; there will be a corresponding |
michael@0 | 111 | * startElement event for every endElement event (even when the |
michael@0 | 112 | * element is empty). |
michael@0 | 113 | * |
michael@0 | 114 | * For information on the names, see startElement. |
michael@0 | 115 | * |
michael@0 | 116 | * @param uri the Namespace URI, or the empty string if the |
michael@0 | 117 | * element has no Namespace URI or if Namespace |
michael@0 | 118 | * processing is not being performed |
michael@0 | 119 | * @param localName the local name (without prefix), or the |
michael@0 | 120 | * empty string if Namespace processing is not being |
michael@0 | 121 | * performed |
michael@0 | 122 | * @param qName the qualified XML name (with prefix), or the |
michael@0 | 123 | * empty string if qualified names are not available |
michael@0 | 124 | */ |
michael@0 | 125 | void endElement(in AString uri, in AString localName, in AString qName); |
michael@0 | 126 | |
michael@0 | 127 | /** |
michael@0 | 128 | * Receive notification of character data. |
michael@0 | 129 | * |
michael@0 | 130 | * The Parser will call this method to report each chunk of |
michael@0 | 131 | * character data. SAX parsers may return all contiguous character |
michael@0 | 132 | * data in a single chunk, or they may split it into several chunks; |
michael@0 | 133 | * however, all of the characters in any single event must come from |
michael@0 | 134 | * the same external entity so that the Locator provides useful |
michael@0 | 135 | * information. |
michael@0 | 136 | * |
michael@0 | 137 | * Note that some parsers will report whitespace in element |
michael@0 | 138 | * content using the ignorableWhitespace method rather than this one |
michael@0 | 139 | * (validating parsers must do so). |
michael@0 | 140 | * |
michael@0 | 141 | * @param value the characters from the XML document |
michael@0 | 142 | */ |
michael@0 | 143 | void characters(in AString value); |
michael@0 | 144 | |
michael@0 | 145 | /** |
michael@0 | 146 | * Receive notification of a processing instruction. |
michael@0 | 147 | * |
michael@0 | 148 | * The Parser will invoke this method once for each processing |
michael@0 | 149 | * instruction found: note that processing instructions may occur |
michael@0 | 150 | * before or after the main document element. |
michael@0 | 151 | * |
michael@0 | 152 | * A SAX parser must never report an XML declaration (XML 1.0, |
michael@0 | 153 | * section 2.8) or a text declaration (XML 1.0, section 4.3.1) using |
michael@0 | 154 | * this method. |
michael@0 | 155 | * |
michael@0 | 156 | * @param target the processing instruction target |
michael@0 | 157 | * @param data the processing instruction data, or null if |
michael@0 | 158 | * none was supplied. The data does not include any |
michael@0 | 159 | * whitespace separating it from the target |
michael@0 | 160 | */ |
michael@0 | 161 | void processingInstruction(in AString target, in AString data); |
michael@0 | 162 | |
michael@0 | 163 | /** |
michael@0 | 164 | * Receive notification of ignorable whitespace in element content. |
michael@0 | 165 | * |
michael@0 | 166 | * Validating Parsers must use this method to report each chunk of |
michael@0 | 167 | * whitespace in element content (see the W3C XML 1.0 |
michael@0 | 168 | * recommendation, section 2.10): non-validating parsers may also |
michael@0 | 169 | * use this method if they are capable of parsing and using content |
michael@0 | 170 | * models. |
michael@0 | 171 | * |
michael@0 | 172 | * SAX parsers may return all contiguous whitespace in a single |
michael@0 | 173 | * chunk, or they may split it into several chunks; however, all of |
michael@0 | 174 | * the characters in any single event must come from the same |
michael@0 | 175 | * external entity, so that the Locator provides useful information. |
michael@0 | 176 | * |
michael@0 | 177 | * @param whitespace the characters from the XML document |
michael@0 | 178 | */ |
michael@0 | 179 | void ignorableWhitespace(in AString whitespace); |
michael@0 | 180 | |
michael@0 | 181 | /** |
michael@0 | 182 | * Begin the scope of a prefix-URI Namespace mapping. |
michael@0 | 183 | * |
michael@0 | 184 | * The information from this event is not necessary for normal |
michael@0 | 185 | * Namespace processing: the SAX XML reader will automatically |
michael@0 | 186 | * replace prefixes for element and attribute names when the |
michael@0 | 187 | * http://xml.org/sax/features/namespaces feature is |
michael@0 | 188 | * true (the default). |
michael@0 | 189 | * |
michael@0 | 190 | * There are cases, however, when applications need to use prefixes |
michael@0 | 191 | * in character data or in attribute values, where they cannot |
michael@0 | 192 | * safely be expanded automatically; the start/endPrefixMapping |
michael@0 | 193 | * event supplies the information to the application to expand |
michael@0 | 194 | * prefixes in those contexts itself, if necessary. |
michael@0 | 195 | * |
michael@0 | 196 | * Note that start/endPrefixMapping events are not guaranteed to be |
michael@0 | 197 | * properly nested relative to each other: all startPrefixMapping |
michael@0 | 198 | * events will occur immediately before the corresponding |
michael@0 | 199 | * startElement event, and all endPrefixMapping events will occur |
michael@0 | 200 | * immediately after the corresponding endElement event, but their |
michael@0 | 201 | * order is not otherwise guaranteed. |
michael@0 | 202 | * |
michael@0 | 203 | * There should never be start/endPrefixMapping events for the |
michael@0 | 204 | * "xml" prefix, since it is predeclared and immutable. |
michael@0 | 205 | * |
michael@0 | 206 | * @param prefix The Namespace prefix being declared. An empty |
michael@0 | 207 | * string is used for the default element namespace, |
michael@0 | 208 | * which has no prefix. |
michael@0 | 209 | * @param uri The Namespace URI the prefix is mapped to. |
michael@0 | 210 | */ |
michael@0 | 211 | void startPrefixMapping(in AString prefix, in AString uri); |
michael@0 | 212 | |
michael@0 | 213 | /** |
michael@0 | 214 | * End the scope of a prefix-URI mapping. |
michael@0 | 215 | * |
michael@0 | 216 | * See startPrefixMapping for details. These events will always |
michael@0 | 217 | * occur immediately after the corresponding endElement event, but |
michael@0 | 218 | * the order of endPrefixMapping events is not otherwise guaranteed. |
michael@0 | 219 | * |
michael@0 | 220 | * @param prefix The prefix that was being mapped. This is the empty |
michael@0 | 221 | * string when a default mapping scope ends. |
michael@0 | 222 | */ |
michael@0 | 223 | void endPrefixMapping(in AString prefix); |
michael@0 | 224 | //XXX documentLocator |
michael@0 | 225 | }; |