parser/xml/public/nsISAXAttributes.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/parser/xml/public/nsISAXAttributes.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,150 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +/**
    1.12 + * Interface for a list of XML attributes.
    1.13 + *
    1.14 + * This interface allows access to a list of attributes in
    1.15 + * three different ways:
    1.16 + *
    1.17 + * 1.) by attribute index;
    1.18 + * 2.) by Namespace-qualified name; or
    1.19 + * 3.) by XML qualified name.
    1.20 + *
    1.21 + * The list will not contain attributes that were declared #IMPLIED
    1.22 + * but not specified in the start tag.  It will also not contain
    1.23 + * attributes used as Namespace declarations (xmlns*) unless the
    1.24 + * http://xml.org/sax/features/namespace-prefixes feature
    1.25 + * is set to true (it is false by default).
    1.26 + *
    1.27 + * The order of attributes in the list is unspecified.
    1.28 + */
    1.29 +[scriptable, uuid(e347005e-6cd0-11da-be43-001422106990)]
    1.30 +interface nsISAXAttributes : nsISupports
    1.31 +{
    1.32 +  /**
    1.33 +   * Look up the index of an attribute by Namespace name.
    1.34 +   * @param uri The Namespace URI, or the empty string
    1.35 +   *            if the name has no Namespace URI.
    1.36 +   * @param localName The attribute's local name.
    1.37 +   * @return The index of the attribute, or -1
    1.38 +   *         if it does not appear in the list.
    1.39 +   */
    1.40 +  long getIndexFromName(in AString uri, in AString localName);
    1.41 +
    1.42 +  /**
    1.43 +   * Look up the index of an attribute by XML qualified name.
    1.44 +   * @param qName The qualified name.
    1.45 +   * @return The index of the attribute, or -1
    1.46 +   *         if it does not appear in the list.
    1.47 +   */
    1.48 +  long getIndexFromQName(in AString qName);
    1.49 +
    1.50 +  /**
    1.51 +   * Return the number of attributes in the list. Once you know the
    1.52 +   * number of attributes, you can iterate through the list.
    1.53 +   *
    1.54 +   * @return The number of attributes in the list.
    1.55 +   */
    1.56 +  readonly attribute long length;
    1.57 +
    1.58 +  /**
    1.59 +   * Look up an attribute's local name by index.
    1.60 +   * @param index The attribute index (zero-based).
    1.61 +   * @return The local name, or null if the index is out of range.
    1.62 +   */
    1.63 +  AString getLocalName(in unsigned long index);
    1.64 +
    1.65 +  /**
    1.66 +   * Look up an attribute's XML qualified name by index.
    1.67 +   * @param index The attribute index (zero-based).
    1.68 +   * @return The XML qualified name, or the empty string if none is
    1.69 +   *         available, or null if the index is out of range.
    1.70 +   */
    1.71 +  AString getQName(in unsigned long index);
    1.72 +
    1.73 +  /**
    1.74 +   * Look up an attribute's type by index. The attribute type is one
    1.75 +   * of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN",
    1.76 +   * "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper
    1.77 +   * case). If the parser has not read a declaration for the
    1.78 +   * attribute, or if the parser does not report attribute types, then
    1.79 +   * it must return the value "CDATA" as stated in the XML 1.0
    1.80 +   * Recommendation (clause 3.3.3, "Attribute-Value
    1.81 +   * Normalization"). For an enumerated attribute that is not a
    1.82 +   * notation, the parser will report the type as "NMTOKEN".
    1.83 +   *
    1.84 +   * @param index The attribute index (zero-based).
    1.85 +   * @return The attribute's type as a string, or null if the index is
    1.86 +   *         out of range.
    1.87 +   */
    1.88 +  AString getType(in unsigned long index);
    1.89 +
    1.90 +  /**
    1.91 +   * Look up an attribute's type by Namespace name.
    1.92 +   * @param uri The Namespace URI, or the empty string
    1.93 +   *             if the name has no Namespace URI.
    1.94 +   * @param localName The attribute's local name.
    1.95 +   * @return The attribute type as a string, or null if the attribute
    1.96 +   *         is not in the list.
    1.97 +   */
    1.98 +  AString getTypeFromName(in AString uri, in AString localName);
    1.99 +
   1.100 +  /**
   1.101 +   * Look up an attribute's type by XML qualified name.
   1.102 +   * @param qName The qualified name.
   1.103 +   * @return The attribute type as a string, or null if the attribute
   1.104 +   *         is not in the list.
   1.105 +   */
   1.106 +  AString getTypeFromQName(in AString qName);
   1.107 +
   1.108 +  /**
   1.109 +   * Look up an attribute's Namespace URI by index.
   1.110 +   * @param index The attribute index (zero-based).
   1.111 +   * @return The Namespace URI, or the empty string if none is available,
   1.112 +   *         or null if the index is out of range.
   1.113 +   */
   1.114 +  AString getURI(in unsigned long index);
   1.115 +
   1.116 +  /**
   1.117 +   * Look up an attribute's value by index.  If the attribute value is
   1.118 +   * a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens will
   1.119 +   * be concatenated into a single string with each token separated by
   1.120 +   * a single space.
   1.121 +   *
   1.122 +   * @param index The attribute index (zero-based).
   1.123 +   * @return The attribute's value as a string, or null if the index is
   1.124 +   *         out of range.
   1.125 +   */
   1.126 +  AString getValue(in unsigned long index);
   1.127 +
   1.128 +  /**
   1.129 +   * Look up an attribute's value by Namespace name.  If the attribute
   1.130 +   * value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the
   1.131 +   * tokens will be concatenated into a single string with each token
   1.132 +   * separated by a single space.
   1.133 +   *
   1.134 +   * @param uri The Namespace URI, or the empty string
   1.135 +   *             if the name has no Namespace URI.
   1.136 +   * @param localName The attribute's local name.
   1.137 +   * @return The attribute's value as a string, or null if the attribute is
   1.138 +   *         not in the list.
   1.139 +   */
   1.140 +  AString getValueFromName(in AString uri, in AString localName);
   1.141 +
   1.142 +  /**
   1.143 +   * Look up an attribute's value by XML qualified (prefixed) name.
   1.144 +   * If the attribute value is a list of tokens (IDREFS, ENTITIES, or
   1.145 +   * NMTOKENS), the tokens will be concatenated into a single string
   1.146 +   * with each token separated by a single space.
   1.147 +   *
   1.148 +   * @param qName The qualified (prefixed) name.
   1.149 +   * @return The attribute's value as a string, or null if the attribute is
   1.150 +   *         not in the list.
   1.151 +   */
   1.152 +  AString getValueFromQName(in AString qName);
   1.153 +};

mercurial