Back to index

lightning-sunbird  0.9+nobinonly
nsIXMLContentBuilder.idl
Go to the documentation of this file.
00001 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Mozilla XTF project.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Alex Fritze.
00019  * Portions created by the Initial Developer are Copyright (C) 2004
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Alex Fritze <alex@croczilla.com> (original author)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "nsISupports.idl"
00040 
00041 interface nsIDOMElement;
00042 interface nsIDOMDocument;
00043 
00044 [scriptable, uuid(e9c4cd4f-cd41-43d0-bf3b-48abb9cde90f)]
00045 interface nsIXMLContentBuilder : nsISupports
00046 {
00047   // (Re-)Initialize this builder. Set 'root' as the new root and
00048   // current element. If 'root' is null, the first element built (with
00049   // 'beginElement()') will become the new root. Also resets the
00050   // element namespace.
00051   void clear(in nsIDOMElement root);
00052 
00053   // Set the document which will be used by 'beginElement()' to create
00054   // elements. If null, the builder will create a new XML document
00055   // internally.
00056   void setDocument(in nsIDOMDocument doc);
00057   
00058   // Set the namespace for all elements built subsequently
00059   void setElementNamespace(in AString ns);
00060 
00061   // Create an element. The element will become the 'current' element,
00062   // i.e. the target for attributes (via 'attrib()') or child content
00063   // (via subsequent begin/endElement()-calls), until it is 'closed'
00064   // with a call to 'endElement()'.
00065   void beginElement(in AString tagname);
00066   void endElement();
00067 
00068   // Set an attribute on the current element
00069   void attrib(in AString name, in AString value);
00070 
00071   // Create a textNode
00072   void textNode(in AString text);
00073   
00074   readonly attribute nsIDOMElement root;
00075   readonly attribute nsIDOMElement current;
00076 };
00077 
00078 %{C++
00079 
00080 // {E09AF32D-2A54-4D76-9EF0-3070E83F8BE7}
00081 #define NS_XMLCONTENTBUILDER_CID \
00082 { 0xe09af32d, 0x2a54, 0x4d76, { 0x9e, 0xf0, 0x30, 0x70, 0xe8, 0x3f, 0x8b, 0xe7 } }
00083     
00084 #define NS_XMLCONTENTBUILDER_CONTRACTID "@mozilla.org/xtf/xml-contentbuilder;1"
00085 
00086 nsresult NS_NewXMLContentBuilder(nsIXMLContentBuilder** aResult);
00087 
00088 %}
00089