1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/parser/htmlparser/public/nsIExpatSink.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,113 @@ 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 +interface nsIScriptError; 1.11 + 1.12 +/** 1.13 + * This interface should be implemented by any content sink that wants 1.14 + * to get output from expat and do something with it; in other words, 1.15 + * by any sink that handles some sort of XML dialect. 1.16 + */ 1.17 + 1.18 +[scriptable, uuid(f61c56b5-ea5b-42b4-ad3c-17416e72e238)] 1.19 +interface nsIExpatSink : nsISupports 1.20 +{ 1.21 + /** 1.22 + * Called to handle the opening tag of an element. 1.23 + * @param aName the fully qualified tagname of the element 1.24 + * @param aAtts the array of attribute names and values. There are 1.25 + * aAttsCount/2 names and aAttsCount/2 values, so the total number of 1.26 + * elements in the array is aAttsCount. The names and values 1.27 + * alternate. Thus, if we number attributes starting with 0, 1.28 + * aAtts[2*k] is the name of the k-th attribute and aAtts[2*k+1] is 1.29 + * the value of that attribute Both explicitly specified attributes 1.30 + * and attributes that are defined to have default values in a DTD are 1.31 + * present in aAtts. 1.32 + * @param aAttsCount the number of elements in aAtts. 1.33 + * @param aIndex If the element has an attribute of type ID, then 1.34 + * aAtts[aIndex] is the name of that attribute. Otherwise, aIndex 1.35 + * is -1 1.36 + * @param aLineNumber the line number of the start tag in the data stream. 1.37 + */ 1.38 + void HandleStartElement(in wstring aName, 1.39 + [array, size_is(aAttsCount)] in wstring aAtts, 1.40 + in unsigned long aAttsCount, 1.41 + in long aIndex, 1.42 + in unsigned long aLineNumber); 1.43 + 1.44 + /** 1.45 + * Called to handle the closing tag of an element. 1.46 + * @param aName the fully qualified tagname of the element 1.47 + */ 1.48 + void HandleEndElement(in wstring aName); 1.49 + 1.50 + /** 1.51 + * Called to handle a comment 1.52 + * @param aCommentText the text of the comment (not including the 1.53 + * "<!--" and "-->") 1.54 + */ 1.55 + void HandleComment(in wstring aCommentText); 1.56 + 1.57 + /** 1.58 + * Called to handle a CDATA section 1.59 + * @param aData the text in the CDATA section. This is null-terminated. 1.60 + * @param aLength the length of the aData string 1.61 + */ 1.62 + void HandleCDataSection([size_is(aLength)] in wstring aData, 1.63 + in unsigned long aLength); 1.64 + 1.65 + /** 1.66 + * Called to handle the doctype declaration 1.67 + */ 1.68 + void HandleDoctypeDecl(in AString aSubset, 1.69 + in AString aName, 1.70 + in AString aSystemId, 1.71 + in AString aPublicId, 1.72 + in nsISupports aCatalogData); 1.73 + 1.74 + /** 1.75 + * Called to handle character data. Note that this does NOT get 1.76 + * called for the contents of CDATA sections. 1.77 + * @param aData the data to handle. aData is NOT NULL-TERMINATED. 1.78 + * @param aLength the length of the aData string 1.79 + */ 1.80 + void HandleCharacterData([size_is(aLength)] in wstring aData, 1.81 + in unsigned long aLength); 1.82 + 1.83 + /** 1.84 + * Called to handle a processing instruction 1.85 + * @param aTarget the PI target (e.g. xml-stylesheet) 1.86 + * @param aData all the rest of the data in the PI 1.87 + */ 1.88 + void HandleProcessingInstruction(in wstring aTarget, 1.89 + in wstring aData); 1.90 + 1.91 + /** 1.92 + * Handle the XML Declaration. 1.93 + * 1.94 + * @param aVersion The version string, can be null if not specified. 1.95 + * @param aEncoding The encoding string, can be null if not specified. 1.96 + * @param aStandalone -1, 0, or 1 indicating respectively that there was no 1.97 + * standalone parameter in the declaration, that it was 1.98 + * given as no, or that it was given as yes. 1.99 + */ 1.100 + void HandleXMLDeclaration(in wstring aVersion, 1.101 + in wstring aEncoding, 1.102 + in long aStandalone); 1.103 + 1.104 + /** 1.105 + * Ask the content sink if the expat driver should log an error to the console. 1.106 + * 1.107 + * @param aErrorText Error message to pass to content sink. 1.108 + * @param aSourceText Source text of the document we're parsing. 1.109 + * @param aError Script error object with line number & column number 1.110 + * 1.111 + * @retval True if the expat driver should report the error. 1.112 + */ 1.113 + boolean ReportError(in wstring aErrorText, 1.114 + in wstring aSourceText, 1.115 + in nsIScriptError aError); 1.116 +};