/* ***** 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 XML editor.
 *
 * The Initial Developer of the Original Code is
 * Alexander J. Vincent <ajvincent@gmail.com>.
 * Portions created by the Initial Developer are Copyright (C) 2005
 * 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"
#include "nsISupportsPrimitives.idl"
#include "xeILanguagePackService.idl"
#include "nsIDOMNode.idl"
#include "nsIDOMElement.idl"

/* This interface is for XML language packs, each of which defines key facts
 * for the application about a particular XML language.
 * (XML documents can accept operations from multiple languages, unlike other
 * documents.)
 */

interface xeIXMLDocumentWrapper;

[scriptable, uuid(199888e5-e4a5-4062-b96b-ef250d7b06bf)]
interface xeIXMLLanguagePackService : xeILanguagePackService {
  // The namespace URI of the language.
  readonly attribute ACString namespaceURI;

  // The default prefix associated with the namespace URI.
  readonly attribute ACString prefix;

  // XXX ajvincent Make these return arrays: multiple DTD's/schemas per spec.

  /**
   * Get the DTD's associated with this language pack as an array.
   *
   * @param count Number of items in the array.
   * @param array of DTD URI's.
   */
  void getDTDUriArray(out PRUint32 count,
                      [array, size_is(count), retval] out nsISupportsString array);

  /**
   * Get the XML Schema documents associated with this language pack as an array.
   *
   * @param count Number of items in the array.
   * @param array of XML Schema URI's.
   */
  void getXMLSchemaArray(out PRUint32 count,
                         [array, size_is(count), retval] out nsISupportsString array);

  // A generic element local name for attributes-only templates.  Ex. <html:span/>
  readonly attribute ACString attributeWrapperName;

  // Language pack requires removing ignorable whitespace nodes.
  const short WHITESPACE_REMOVE    = 0x00000001;

  // Language pack does not care about ignorable whitespace nodes.
  const short WHITESPACE_IGNORABLE = 0x00000002;

  // Language pack requires preserving ignorable whitespace nodes.
  const short WHITESPACE_PRESERVE  = 0x00000004;

  // Language pack states the whitespace state applies to all language elements.
  const short WHITESPACE_GLOBAL    = 0x00010000;

  /**
   * Report how to treat whitespace children of elements with a given local name.
   *
   * @param aLocalName Local name of an element.
   */
  long handleWhitespace(in ACString aLocalName);

  /**
   * Find out if a node's value represents a loadable URI.
   *
   * @param aNode Data or attribute node to check.
   *
   * @return True if the node value is a loadable URI.
   */
  boolean isURINode(in nsIDOMNode aNode);

  /**
   * Check the validity of a given element
   *
   * @param aElement Root element to check for validity.
   * @param aWrapper Document wrapper used to format error reports.
   * @param aRecursive True if the component should check descendants as well.
   *
   * @return nsIScriptError with warning flag if there is a validity error, or null.
   */
  nsIScriptError checkValidity(in nsIDOMElement aElement,
                               in xeIXMLDocumentWrapper aWrapper,
                               in boolean aRecursive);
};
