/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Verbosio DTD Entities Wrapper.
 *
 * The Initial Developer of the Original Code is
 * Alexander J. Vincent <ajvincent@gmail.com>.
 * Portions created by the Initial Developer are Copyright (C) 2007
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "nsISupports.idl"

interface xeIDocumentWrapper;
interface xeIDocumentPack;

/* All XML document wrappers have this interface as a property.  In addition,
   Verbosio's core provides a DTD document wrapper which also implements this
   interface.

   The contract ID for the DTD subset wrapper component is:
   "@verbosio.mozdev.org/dtd-subset-wrapper/gecko;1"
 */

[scriptable, uuid(13d3d0eb-8b59-4147-a566-e6ec03a5e305)]
interface xeIDTDWrapper : nsISupports
{
  /**
   * Get the external DTD wrapper references in this DTD.
   */
  void getExternalDTDReferences(out unsigned long aCount,
                                [retval, array, size_is(aCount)]
                                out wstring aValues);

  /**
   * Get the DTD wrappers this DTD imports.
   */
  void getExternalDTDWrappers(out unsigned long aCount,
                              [retval, array, size_is(aCount)]
                              out xeIDTDWrapper aValues);

  /**
   * Get the entity names this DTD holds.
   */
  void getInternalEntityNames(out unsigned long aCount,
                              [retval, array, size_is(aCount)]
                              out wstring aValues);

  /**
   * Get the value of an entity.
   *
   * @param aName The name of the entity.
   *
   * @return The value of the entity.
   */
  ACString getEntityValue(in ACString aName);

  /**
   * Get the value of an external DTD reference.
   *
   * @param aName The name of the entity.
   *
   * @return The value of the entity.
   */
  ACString getDTDRefValue(in ACString aName);

  /**
   * Set the value of an entity.
   *
   * @param aName  The name of the entity.
   * @param aValue The value of the entity.
   *
   * @note This also changes entity references to use the new value.
   */
  void setEntityValue(in ACString aName,
                      in ACString aValue);

  /**
   * Get the location of the DTD.
   */
  readonly attribute xeIDocumentWrapper baseWrapper;

  /**
   * Parse the DTD entities in a doctype's internal subset or a DTD file.
   *
   * @param aSource The DTD fragment to parse.
   * @param aWrapper Document wrapper with base URI map, document pack.
   */
  void parseDTD(in ACString aSource,
                in xeIDocumentWrapper aWrapper,
                in xeIDocumentPack aPack);
};
