Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

447 lines
13 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1998
  5. //
  6. // File: xmlparser.idl
  7. //7
  8. //--------------------------------------------------------------------------
  9. cpp_quote("//+-------------------------------------------------------------------------")
  10. cpp_quote("//")
  11. cpp_quote("// Microsoft Windows")
  12. cpp_quote("// Copyright (C) Microsoft Corporation, 1998.")
  13. cpp_quote("//")
  14. cpp_quote("//--------------------------------------------------------------------------")
  15. #ifndef DO_NO_IMPORTS
  16. import "unknwn.idl";
  17. import "wtypes.idl";
  18. import "objidl.idl";
  19. import "oaidl.idl";
  20. #endif
  21. interface IXMLNodeSource;
  22. interface IXMLParser;
  23. interface IXMLNodeFactory;
  24. interface IMoniker;
  25. // This is the full list of node types that can be used in CreateNode.
  26. typedef enum
  27. {
  28. // -------------- Container Nodes -----------------
  29. XML_ELEMENT = 1, // <foo ... >
  30. XML_ATTRIBUTE, // <foo bar=...>
  31. XML_PI, // <?foo ...?>
  32. XML_XMLDECL, // <?xml version=...
  33. XML_DOCTYPE, // <!DOCTYPE
  34. XML_DTDATTRIBUTE, // properties of DTD declarations (like XML_SYSTEM)
  35. XML_ENTITYDECL, // <!ENTITY ...
  36. XML_ELEMENTDECL, // <!ELEMENT ...
  37. XML_ATTLISTDECL, // <!ATTLIST ...
  38. XML_NOTATION, // <!NOTATION ...
  39. XML_GROUP, // The ( ... ) grouping in content models.
  40. XML_INCLUDESECT, // <![ INCLUDE [... ]]>
  41. // -------------- Terminal Nodes -------------------
  42. XML_PCDATA, // text inside a node or an attribute.
  43. XML_CDATA, // <![CDATA[...]]>
  44. XML_IGNORESECT, // <![ IGNORE [...]]>
  45. XML_COMMENT, // <!--' and '-->
  46. XML_ENTITYREF, // &foo;
  47. XML_WHITESPACE, // white space between elements
  48. XML_NAME, // general NAME token for typed attribute values or DTD declarations
  49. XML_NMTOKEN, // general NMTOKEN for typed attribute values or DTD declarations
  50. XML_STRING, // general quoted string literal in DTD declarations.
  51. XML_PEREF, // %foo;
  52. XML_MODEL, // EMPTY, ANY of MIXED.
  53. XML_ATTDEF, // Name of attribute being defined.
  54. XML_ATTTYPE,
  55. XML_ATTPRESENCE,
  56. XML_DTDSUBSET, // entire DTD subset as a string.
  57. XML_LASTNODETYPE, // not used
  58. } XML_NODE_TYPE;
  59. // The subtypes
  60. typedef enum
  61. {
  62. // for XML_ATTRIBUTE
  63. XML_VERSION = XML_LASTNODETYPE, // for <?xml declarations?>
  64. XML_ENCODING,
  65. XML_STANDALONE,
  66. XML_NS, // for namespace attributes.
  67. XML_XMLSPACE, // xml:space
  68. XML_XMLLANG, // xml:lang
  69. // for XML_DTDATTRIBUTE
  70. XML_SYSTEM, // SYSTEM literal
  71. XML_PUBLIC, // PUBLIC literal
  72. XML_NDATA, // NDATA name in ENTITY declarations
  73. // for XML_ATTTYPE
  74. XML_AT_CDATA, // ATTLIST attribute types.
  75. XML_AT_ID,
  76. XML_AT_IDREF,
  77. XML_AT_IDREFS,
  78. XML_AT_ENTITY,
  79. XML_AT_ENTITIES,
  80. XML_AT_NMTOKEN,
  81. XML_AT_NMTOKENS,
  82. XML_AT_NOTATION,
  83. // for XML_ATTPRESENCE
  84. XML_AT_REQUIRED,
  85. XML_AT_IMPLIED,
  86. XML_AT_FIXED,
  87. // XML_ENTITYDECL subtype
  88. XML_PENTITYDECL, // <!ENTITY % ...
  89. // XML_MODEL subtypes
  90. XML_EMPTY, // EMPTY
  91. XML_ANY, // ANY
  92. XML_MIXED, // (#PCDATA
  93. XML_SEQUENCE, // ,
  94. XML_CHOICE, // |
  95. XML_STAR, // +
  96. XML_PLUS, // *
  97. XML_QUESTIONMARK, // ?
  98. XML_LASTSUBNODETYPE, // not used
  99. }
  100. XML_NODE_SUBTYPE;
  101. // Possible error codes include S_OK, E_PENDING and the following:
  102. typedef enum
  103. {
  104. XML_E_PARSEERRORBASE = 0xC00CE500L,
  105. // character level error codes.
  106. XML_E_ENDOFINPUT = XML_E_PARSEERRORBASE,
  107. XML_E_MISSINGEQUALS, // 1
  108. XML_E_MISSINGQUOTE, // 2
  109. XML_E_COMMENTSYNTAX, // 3
  110. XML_E_BADSTARTNAMECHAR, // 4
  111. XML_E_BADNAMECHAR, // 5
  112. XML_E_BADCHARINSTRING, // 6
  113. XML_E_XMLDECLSYNTAX, // 7
  114. XML_E_BADCHARDATA, // 8
  115. XML_E_MISSINGWHITESPACE, // 9
  116. XML_E_EXPECTINGTAGEND, // A
  117. XML_E_BADCHARINDTD, // B
  118. XML_E_BADCHARINDECL, // C
  119. XML_E_MISSINGSEMICOLON, // D
  120. XML_E_BADCHARINENTREF, // E
  121. XML_E_UNBALANCEDPAREN, // F
  122. XML_E_EXPECTINGOPENBRACKET, // 10
  123. XML_E_BADENDCONDSECT, // 11
  124. XML_E_INTERNALERROR, // 12
  125. XML_E_UNEXPECTED_WHITESPACE, // 13
  126. XML_E_INCOMPLETE_ENCODING, // 14
  127. XML_E_BADCHARINMIXEDMODEL, // 15
  128. XML_E_MISSING_STAR, // 16
  129. XML_E_BADCHARINMODEL, // 17
  130. XML_E_MISSING_PAREN, // 18
  131. XML_E_BADCHARINENUMERATION, // 19
  132. XML_E_PIDECLSYNTAX, // 1A
  133. XML_E_EXPECTINGCLOSEQUOTE, // 1B
  134. XML_E_MULTIPLE_COLONS, // 1C
  135. XML_E_INVALID_DECIMAL, // 1D
  136. XML_E_INVALID_HEXIDECIMAL, // 1E
  137. XML_E_INVALID_UNICODE, // 1F
  138. XML_E_WHITESPACEORQUESTIONMARK, // 20
  139. // token level error codes
  140. XML_E_TOKEN_ERROR = XML_E_PARSEERRORBASE + 0x50,
  141. XML_E_SUSPENDED = XML_E_TOKEN_ERROR,// 50
  142. XML_E_STOPPED, // 51
  143. XML_E_UNEXPECTEDENDTAG, // 52
  144. XML_E_UNCLOSEDTAG, // 53
  145. XML_E_DUPLICATEATTRIBUTE, // 54
  146. XML_E_MULTIPLEROOTS, // 55
  147. XML_E_INVALIDATROOTLEVEL, // 56
  148. XML_E_BADXMLDECL, // 57
  149. XML_E_MISSINGROOT, // 58
  150. XML_E_UNEXPECTEDEOF, // 59
  151. XML_E_BADPEREFINSUBSET, // 5A
  152. XML_E_PE_NESTING, // 5B
  153. XML_E_INVALID_CDATACLOSINGTAG, // 5C
  154. XML_E_UNCLOSEDPI, // 5D
  155. XML_E_UNCLOSEDSTARTTAG, // 5E
  156. XML_E_UNCLOSEDENDTAG, // 5F
  157. XML_E_UNCLOSEDSTRING, // 60
  158. XML_E_UNCLOSEDCOMMENT, // 61
  159. XML_E_UNCLOSEDDECL, // 62
  160. XML_E_UNCLOSEDMARKUPDECL, // 63
  161. XML_E_UNCLOSEDCDATA, // 64
  162. XML_E_BADDECLNAME, // 65
  163. XML_E_BADEXTERNALID, // 66
  164. XML_E_BADELEMENTINDTD, // 67
  165. XML_E_RESERVEDNAMESPACE, // 68
  166. XML_E_EXPECTING_VERSION, // 69
  167. XML_E_EXPECTING_ENCODING, // 6A
  168. XML_E_EXPECTING_NAME, // 6B
  169. XML_E_UNEXPECTED_ATTRIBUTE, // 6C
  170. XML_E_ENDTAGMISMATCH, // 6D
  171. XML_E_INVALIDENCODING, // 6E
  172. XML_E_INVALIDSWITCH, // 6F
  173. XML_E_EXPECTING_NDATA, // 70
  174. XML_E_INVALID_MODEL, // 71
  175. XML_E_INVALID_TYPE, // 72
  176. XML_E_INVALIDXMLSPACE, // 73
  177. XML_E_MULTI_ATTR_VALUE, // 74
  178. XML_E_INVALID_PRESENCE, // 75
  179. XML_E_BADXMLCASE, // 76
  180. XML_E_CONDSECTINSUBSET, // 77
  181. XML_E_CDATAINVALID, // 78
  182. XML_E_INVALID_STANDALONE, // 79
  183. XML_E_UNEXPECTED_STANDALONE, // 7A
  184. XML_E_DOCTYPE_IN_DTD, // 7B
  185. XML_E_MISSING_ENTITY, // 7C
  186. XML_E_ENTITYREF_INNAME, // 7D
  187. XML_E_DOCTYPE_OUTSIDE_PROLOG, // 7E
  188. XML_E_INVALID_VERSION, // 7F
  189. XML_E_DTDELEMENT_OUTSIDE_DTD, // 80
  190. XML_E_DUPLICATEDOCTYPE, // 81
  191. XML_E_RESOURCE, // 82
  192. XML_E_LASTERROR,
  193. } XML_ERROR_CODE;
  194. // Possible ready states
  195. typedef enum
  196. {
  197. XMLPARSER_IDLE,
  198. XMLPARSER_WAITING,
  199. XMLPARSER_BUSY,
  200. XMLPARSER_ERROR,
  201. XMLPARSER_STOPPED,
  202. XMLPARSER_SUSPENDED
  203. } XML_PARSER_STATE;
  204. // Some parser flags which can be OR'd together.
  205. // By default all flags are clear.
  206. // DTD and ENTITY are mutually exclusive.
  207. typedef enum
  208. {
  209. XMLFLAG_FLOATINGAMP = 1,
  210. XMLFLAG_SHORTENDTAGS = 2,
  211. XMLFLAG_CASEINSENSITIVE = 4,
  212. XMLFLAG_NONAMESPACES = 8,
  213. XMLFLAG_NOWHITESPACE = 16,
  214. XMLFLAG_IE4QUIRKS = 32,
  215. XMLFLAG_NODTDNODES = 64,
  216. XMLFLAG_IE4COMPATIBILITY = 255,
  217. } XML_PARSER_FLAGS;
  218. // Some things that node factories can be notified of
  219. typedef enum
  220. {
  221. XMLNF_STARTDOCUMENT,
  222. XMLNF_STARTDTD,
  223. XMLNF_ENDDTD,
  224. XMLNF_STARTDTDSUBSET,
  225. XMLNF_ENDDTDSUBSET,
  226. XMLNF_ENDPROLOG,
  227. XMLNF_STARTENTITY,
  228. XMLNF_ENDENTITY,
  229. XMLNF_ENDDOCUMENT,
  230. XMLNF_DATAAVAILABLE,
  231. XMLNF_LASTEVENT = XMLNF_DATAAVAILABLE
  232. } XML_NODEFACTORY_EVENT;
  233. typedef struct _XML_NODE_INFO
  234. {
  235. DWORD dwSize; // size of this struct
  236. DWORD dwType; // node type (XML_NODE_TYPE)
  237. DWORD dwSubType; // node sub type (XML_NODE_SUBTYPE)
  238. BOOL fTerminal; // whether this node can have any children
  239. const WCHAR* pwcText; // element names, or text node contents.
  240. ULONG ulLen; // length of pwcText
  241. ULONG ulNsPrefixLen; // if element name, this is namespace prefix length.
  242. PVOID pNode; // optionally created by & returned from node factory
  243. PVOID pReserved; // reserved for factories to use between themselves.
  244. } XML_NODE_INFO;
  245. //------------------------------------------------------------------------
  246. // See http://xmlweb/msxml/xmlparser.htm for a description of this interface.
  247. [
  248. uuid(d242361c-51a0-11d2-9caf-0060b0ec3d39), // LIBID_XMLPARSER
  249. helpstring("Microsoft XML Parser 1.0"),
  250. lcid(0x0000),
  251. version(1.0)
  252. ]
  253. library XMLPSR
  254. {
  255. importlib("stdole2.tlb");
  256. [
  257. object,
  258. local,
  259. uuid(d242361d-51a0-11d2-9caf-0060b0ec3d39), // IID_IXMLNodeSource
  260. helpstring("IXMLParser Interface"),
  261. pointer_default(unique)
  262. ]
  263. interface IXMLNodeSource : IUnknown
  264. {
  265. HRESULT SetFactory(
  266. [in] IXMLNodeFactory* pNodeFactory);
  267. HRESULT GetFactory(
  268. [out] IXMLNodeFactory** ppNodeFactory);
  269. HRESULT Abort(
  270. [in] BSTR bstrErrorInfo);
  271. ULONG GetLineNumber();
  272. ULONG GetLinePosition();
  273. ULONG GetAbsolutePosition();
  274. HRESULT GetLineBuffer(
  275. [out] const WCHAR** ppwcBuf,
  276. [out] ULONG* pulLen,
  277. [out] ULONG* pulStartPos);
  278. HRESULT GetLastError();
  279. HRESULT GetErrorInfo(
  280. [out] BSTR* pbstrErrorInfo);
  281. ULONG GetFlags();
  282. HRESULT GetURL(
  283. [out] const WCHAR** ppwcBuf);
  284. };
  285. [
  286. object,
  287. local,
  288. uuid(d242361e-51a0-11d2-9caf-0060b0ec3d39), // IID_IXMLParser
  289. helpstring("IXMLParser Interface"),
  290. pointer_default(unique)
  291. ]
  292. interface IXMLParser : IXMLNodeSource
  293. {
  294. HRESULT SetURL(
  295. [in] const WCHAR* pszBaseUrl,
  296. [in] const WCHAR* pszRelativeUrl,
  297. [in] BOOL fAsync);
  298. HRESULT Load(
  299. [in] BOOL fFullyAvailable,
  300. [in] IMoniker *pimkName,
  301. [in] LPBC pibc,
  302. [in] DWORD grfMode);
  303. HRESULT SetInput(
  304. [in] IUnknown *pStm);
  305. HRESULT PushData(
  306. [in] const char* pData,
  307. [in] ULONG ulChars,
  308. [in] BOOL fLastBuffer);
  309. HRESULT LoadDTD(
  310. [in] const WCHAR* pszBaseUrl,
  311. [in] const WCHAR* pszRelativeUrl);
  312. HRESULT LoadEntity(
  313. [in] const WCHAR* pszBaseUrl,
  314. [in] const WCHAR* pszRelativeUrl,
  315. [in] BOOL fpe);
  316. HRESULT ParseEntity(
  317. [in] const WCHAR* pwcText,
  318. [in] ULONG ulLen,
  319. [in] BOOL fpe);
  320. // Similar to parsing internal parameter entities, except
  321. // it doesn't insert any spaces. This is used to expand
  322. // named entities inside attribute values when DTD specifies
  323. // attribute type other than CDATA.
  324. HRESULT ExpandEntity(
  325. [in] const WCHAR* pwcText,
  326. [in] ULONG ulLen);
  327. HRESULT SetRoot(
  328. [in] PVOID pRoot);
  329. HRESULT GetRoot(
  330. [in] PVOID* ppRoot);
  331. HRESULT Run(
  332. [in] long lChars);
  333. HRESULT GetParserState();
  334. HRESULT Suspend();
  335. HRESULT Reset();
  336. HRESULT SetFlags(
  337. [in] ULONG iFlags);
  338. // This is used as a default if LoadDTD or LoadEntity or SetURL is called
  339. // with a NULL base URL.
  340. HRESULT SetSecureBaseURL(
  341. [in] const WCHAR* pszBaseUrl);
  342. HRESULT GetSecureBaseURL(
  343. [out] const WCHAR** ppwcBuf);
  344. };
  345. [
  346. object,
  347. local,
  348. uuid(d242361f-51a0-11d2-9caf-0060b0ec3d39), // IID_IXMLNodeFactory
  349. helpstring("IXMLNodeFactory Interface"),
  350. pointer_default(unique)
  351. ]
  352. interface IXMLNodeFactory : IUnknown
  353. {
  354. HRESULT NotifyEvent(
  355. [in] IXMLNodeSource* pSource,
  356. [in] XML_NODEFACTORY_EVENT iEvt);
  357. HRESULT BeginChildren(
  358. [in] IXMLNodeSource* pSource,
  359. [in] XML_NODE_INFO* pNodeInfo);
  360. HRESULT EndChildren(
  361. [in] IXMLNodeSource* pSource,
  362. [in] BOOL fEmpty,
  363. [in] XML_NODE_INFO* pNodeInfo);
  364. HRESULT Error(
  365. [in] IXMLNodeSource* pSource,
  366. [in] HRESULT hrErrorCode,
  367. [in] USHORT cNumRecs,
  368. [in] XML_NODE_INFO** apNodeInfo);
  369. HRESULT CreateNode(
  370. [in] IXMLNodeSource* pSource,
  371. [in] PVOID pNodeParent,
  372. [in] USHORT cNumRecs,
  373. [in] XML_NODE_INFO** apNodeInfo);
  374. };
  375. // XMLParser co-Class
  376. [
  377. uuid(d2423620-51a0-11d2-9caf-0060b0ec3d39), // CLSID_XMLParser
  378. helpstring("XML Parser coclass")
  379. ]
  380. coclass XMLParser
  381. {
  382. [default] interface IXMLParser;
  383. }
  384. }