1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is Robert Sayre.
19 * Portions created by the Initial Developer are Copyright (C) 2005
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include
"nsISupports.idl"
41 * Interface for a list of XML attributes.
43 * This interface allows access to a list of attributes in
44 * three different ways:
46 * 1.) by attribute index;
47 * 2.) by Namespace-qualified name; or
48 * 3.) by XML qualified name.
50 * The list will not contain attributes that were declared #IMPLIED
51 * but not specified in the start tag. It will also not contain
52 * attributes used as Namespace declarations (xmlns*) unless the
53 * http://xml.org/sax/features/namespace-prefixes feature
54 * is set to true (it is false by default).
56 * The order of attributes in the list is unspecified.
58 [scriptable
, uuid(e347005e
-6cd0
-11da
-be43
-001422106990)]
59 interface nsISAXAttributes
: nsISupports
62 * Look up the index of an attribute by Namespace name.
63 * @param uri The Namespace URI, or the empty string
64 * if the name has no Namespace URI.
65 * @param localName The attribute's local name.
66 * @return The index of the attribute, or -1
67 * if it does not appear in the list.
69 long getIndexFromName
(in AString uri
, in AString localName
);
72 * Look up the index of an attribute by XML qualified name.
73 * @param qName The qualified name.
74 * @return The index of the attribute, or -1
75 * if it does not appear in the list.
77 long getIndexFromQName
(in AString qName
);
80 * Return the number of attributes in the list. Once you know the
81 * number of attributes, you can iterate through the list.
83 * @return The number of attributes in the list.
85 readonly attribute
long length
;
88 * Look up an attribute's local name by index.
89 * @param index The attribute index (zero-based).
90 * @return The local name, or null if the index is out of range.
92 AString getLocalName
(in unsigned long index
);
95 * Look up an attribute's XML qualified name by index.
96 * @param index The attribute index (zero-based).
97 * @return The XML qualified name, or the empty string if none is
98 * available, or null if the index is out of range.
100 AString getQName
(in unsigned long index
);
103 * Look up an attribute's type by index. The attribute type is one
104 * of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN",
105 * "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper
106 * case). If the parser has not read a declaration for the
107 * attribute, or if the parser does not report attribute types, then
108 * it must return the value "CDATA" as stated in the XML 1.0
109 * Recommendation (clause 3.3.3, "Attribute-Value
110 * Normalization"). For an enumerated attribute that is not a
111 * notation, the parser will report the type as "NMTOKEN".
113 * @param index The attribute index (zero-based).
114 * @return The attribute's type as a string, or null if the index is
117 AString getType
(in unsigned long index
);
120 * Look up an attribute's type by Namespace name.
121 * @param uri The Namespace URI, or the empty string
122 * if the name has no Namespace URI.
123 * @param localName The attribute's local name.
124 * @return The attribute type as a string, or null if the attribute
125 * is not in the list.
127 AString getTypeFromName
(in AString uri
, in AString localName
);
130 * Look up an attribute's type by XML qualified name.
131 * @param qName The qualified name.
132 * @return The attribute type as a string, or null if the attribute
133 * is not in the list.
135 AString getTypeFromQName
(in AString qName
);
138 * Look up an attribute's Namespace URI by index.
139 * @param index The attribute index (zero-based).
140 * @return The Namespace URI, or the empty string if none is available,
141 * or null if the index is out of range.
143 AString getURI
(in unsigned long index
);
146 * Look up an attribute's value by index. If the attribute value is
147 * a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens will
148 * be concatenated into a single string with each token separated by
151 * @param index The attribute index (zero-based).
152 * @return The attribute's value as a string, or null if the index is
155 AString getValue
(in unsigned long index
);
158 * Look up an attribute's value by Namespace name. If the attribute
159 * value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the
160 * tokens will be concatenated into a single string with each token
161 * separated by a single space.
163 * @param uri The Namespace URI, or the empty string
164 * if the name has no Namespace URI.
165 * @param localName The attribute's local name.
166 * @return The attribute's value as a string, or null if the attribute is
169 AString getValueFromName
(in AString uri
, in AString localName
);
172 * Look up an attribute's value by XML qualified (prefixed) name.
173 * If the attribute value is a list of tokens (IDREFS, ENTITIES, or
174 * NMTOKENS), the tokens will be concatenated into a single string
175 * with each token separated by a single space.
177 * @param qName The qualified (prefixed) name.
178 * @return The attribute's value as a string, or null if the attribute is
181 AString getValueFromQName
(in AString qName
);