/parser/htmlparser/public/nsIExpatSink.idl

http://github.com/zpao/v8monkey · IDL · 145 lines · 30 code · 11 blank · 104 comment · 0 complexity · 437a10716b1a57497309351d3ff74aca MD5 · raw file

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is mozilla.org code.
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Netscape Communications Corporation.
  19. * Portions created by the Initial Developer are Copyright (C) 1998
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either of the GNU General Public License Version 2 or later (the "GPL"),
  26. * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. #include "nsISupports.idl"
  38. interface nsIScriptError;
  39. /**
  40. * This interface should be implemented by any content sink that wants
  41. * to get output from expat and do something with it; in other words,
  42. * by any sink that handles some sort of XML dialect.
  43. */
  44. [scriptable, uuid(f61c56b5-ea5b-42b4-ad3c-17416e72e238)]
  45. interface nsIExpatSink : nsISupports
  46. {
  47. /**
  48. * Called to handle the opening tag of an element.
  49. * @param aName the fully qualified tagname of the element
  50. * @param aAtts the array of attribute names and values. There are
  51. * aAttsCount/2 names and aAttsCount/2 values, so the total number of
  52. * elements in the array is aAttsCount. The names and values
  53. * alternate. Thus, if we number attributes starting with 0,
  54. * aAtts[2*k] is the name of the k-th attribute and aAtts[2*k+1] is
  55. * the value of that attribute Both explicitly specified attributes
  56. * and attributes that are defined to have default values in a DTD are
  57. * present in aAtts.
  58. * @param aAttsCount the number of elements in aAtts.
  59. * @param aIndex If the element has an attribute of type ID, then
  60. * aAtts[aIndex] is the name of that attribute. Otherwise, aIndex
  61. * is -1
  62. * @param aLineNumber the line number of the start tag in the data stream.
  63. */
  64. void HandleStartElement(in wstring aName,
  65. [array, size_is(aAttsCount)] in wstring aAtts,
  66. in unsigned long aAttsCount,
  67. in long aIndex,
  68. in unsigned long aLineNumber);
  69. /**
  70. * Called to handle the closing tag of an element.
  71. * @param aName the fully qualified tagname of the element
  72. */
  73. void HandleEndElement(in wstring aName);
  74. /**
  75. * Called to handle a comment
  76. * @param aCommentText the text of the comment (not including the
  77. * "<!--" and "-->")
  78. */
  79. void HandleComment(in wstring aCommentText);
  80. /**
  81. * Called to handle a CDATA section
  82. * @param aData the text in the CDATA section. This is null-terminated.
  83. * @param aLength the length of the aData string
  84. */
  85. void HandleCDataSection([size_is(aLength)] in wstring aData,
  86. in unsigned long aLength);
  87. /**
  88. * Called to handle the doctype declaration
  89. */
  90. void HandleDoctypeDecl(in AString aSubset,
  91. in AString aName,
  92. in AString aSystemId,
  93. in AString aPublicId,
  94. in nsISupports aCatalogData);
  95. /**
  96. * Called to handle character data. Note that this does NOT get
  97. * called for the contents of CDATA sections.
  98. * @param aData the data to handle. aData is NOT NULL-TERMINATED.
  99. * @param aLength the length of the aData string
  100. */
  101. void HandleCharacterData([size_is(aLength)] in wstring aData,
  102. in unsigned long aLength);
  103. /**
  104. * Called to handle a processing instruction
  105. * @param aTarget the PI target (e.g. xml-stylesheet)
  106. * @param aData all the rest of the data in the PI
  107. */
  108. void HandleProcessingInstruction(in wstring aTarget,
  109. in wstring aData);
  110. /**
  111. * Handle the XML Declaration.
  112. *
  113. * @param aVersion The version string, can be null if not specified.
  114. * @param aEncoding The encoding string, can be null if not specified.
  115. * @param aStandalone -1, 0, or 1 indicating respectively that there was no
  116. * standalone parameter in the declaration, that it was
  117. * given as no, or that it was given as yes.
  118. */
  119. void HandleXMLDeclaration(in wstring aVersion,
  120. in wstring aEncoding,
  121. in long aStandalone);
  122. /**
  123. * Ask the content sink if the expat driver should log an error to the console.
  124. *
  125. * @param aErrorText Error message to pass to content sink.
  126. * @param aSourceText Source text of the document we're parsing.
  127. * @param aError Script error object with line number & column number
  128. *
  129. * @retval True if the expat driver should report the error.
  130. */
  131. boolean ReportError(in wstring aErrorText,
  132. in wstring aSourceText,
  133. in nsIScriptError aError);
  134. };