/* ***** BEGIN LICENSE BLOCK *****
 * Version: GPL 3.0
 *
 * The contents of this file are subject to the General Public License
 * 3.0 (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.gnu.org/licenses/gpl.html
 *
 * 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.
 *
 * Author: Michel Verbraak (info@1st-setup.nl)
 * Website: http://www.1st-setup.nl/wordpress/?page_id=133
 * email: exchangecalendar@extensions.1st-setup.nl
 *
 * This XML interface can be used to convert from xml-string to JXON object
 * and back.
 *
 * ***** BEGIN LICENSE BLOCK *****/

#include "nsISupports.idl"

[scriptable, uuid(d7165a60-7d64-42b2-ac48-6ccfc0962abb)]
interface mivIxml2jxon : nsISupports
{

  const unsigned long ERR_MISSING_SPECIAL_TAG = 1;
  const unsigned long ERR_INVALID_TAG = 2;
  const unsigned long ERR_INVALID_SPECIAL_TAG = 3;
  const unsigned long ERR_WRONG_CLOSING_TAG = 4;
  const unsigned long ERR_WRONG_ATTRIBUTE_SEPARATOR = 5;
  const unsigned long ERR_ATTRIBUTE_VALUE_QUOTES = 6;


  readonly attribute AUTF8String XMLHeader;
  readonly attribute boolean isXMLHeader;

  attribute AUTF8String uuid;
  attribute AUTF8String tagName;
  attribute AUTF8String nameSpace;
  attribute boolean closed;
  attribute unsigned long long lastPos;

  void correctNameSpace();
  void processXMLString(in AUTF8String aString, in long aStartPos, in mivIxml2jxon aParent);
  jsval XPath(in AUTF8String aString);
  AUTF8String contentStr();
  readonly attribute AUTF8String value;

  AUTF8String toString([optional] in AUTF8String parentNameSpace);
  mivIxml2jxon clone();

  void setAttribute(in AUTF8String aAttribute, in AUTF8String aValue);
  AUTF8String getAttribute(in AUTF8String aAttribute, [optional] in AUTF8String aDefaultValue);
  AUTF8String getAttributeByTag(in AUTF8String aTagName, in AUTF8String aAttribute, [optional] in AUTF8String aDefaultValue);

  mivIxml2jxon getTag(in AUTF8String aTagName);
  jsval getTags(in AUTF8String aTagName);
  AUTF8String getTagValue(in AUTF8String aTagName, [optional] in AUTF8String aDefaultValue);
  AUTF8String getTagValueByXPath(in AUTF8String aXPath, [optional] in AUTF8String aDefaultValue);
  AUTF8String getNameSpace(in AUTF8String aAlias);
  AUTF8String addNameSpace(in AUTF8String aAlias, in AUTF8String aValue);
  void addToContent(in AUTF8String aValue);

  void addParentNameSpaces(in mivIxml2jxon aParent);
  mivIxml2jxon addChildTagObject(in mivIxml2jxon aObject);
  mivIxml2jxon addChildTag(in AUTF8String aTagName, in AUTF8String aNameSpace, in AUTF8String aValue);
  mivIxml2jxon addSibblingTag(in AUTF8String aTagName, in AUTF8String aNameSpace, in AUTF8String aValue);

  AUTF8String realTagName(in AUTF8String aCurrentTagName);

};
