Leaked source code of windows server 2003
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.

477 lines
15 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. XML_E_ENDOFPE, // 21
  140. // token level error codes
  141. XML_E_TOKEN_ERROR = XML_E_PARSEERRORBASE + 0x50,
  142. XML_E_SUSPENDED = XML_E_TOKEN_ERROR,// 50
  143. XML_E_STOPPED, // 51
  144. XML_E_UNEXPECTEDENDTAG, // 52
  145. XML_E_UNCLOSEDTAG, // 53
  146. XML_E_DUPLICATEATTRIBUTE, // 54
  147. XML_E_MULTIPLEROOTS, // 55
  148. XML_E_INVALIDATROOTLEVEL, // 56
  149. XML_E_BADXMLDECL, // 57
  150. XML_E_MISSINGROOT, // 58
  151. XML_E_UNEXPECTEDEOF, // 59
  152. XML_E_BADPEREFINSUBSET, // 5A
  153. XML_E_PE_NESTING, // 5B
  154. XML_E_INVALID_CDATACLOSINGTAG, // 5C
  155. XML_E_UNCLOSEDPI, // 5D
  156. XML_E_UNCLOSEDSTARTTAG, // 5E
  157. XML_E_UNCLOSEDENDTAG, // 5F
  158. XML_E_UNCLOSEDSTRING, // 60
  159. XML_E_UNCLOSEDCOMMENT, // 61
  160. XML_E_UNCLOSEDDECL, // 62
  161. XML_E_UNCLOSEDMARKUPDECL, // 63
  162. XML_E_UNCLOSEDCDATA, // 64
  163. XML_E_BADDECLNAME, // 65
  164. XML_E_BADEXTERNALID, // 66
  165. XML_E_BADELEMENTINDTD, // 67
  166. XML_E_RESERVEDNAMESPACE, // 68
  167. XML_E_EXPECTING_VERSION, // 69
  168. XML_E_EXPECTING_ENCODING, // 6A
  169. XML_E_EXPECTING_NAME, // 6B
  170. XML_E_UNEXPECTED_ATTRIBUTE, // 6C
  171. XML_E_ENDTAGMISMATCH, // 6D
  172. XML_E_INVALIDENCODING, // 6E
  173. XML_E_INVALIDSWITCH, // 6F
  174. XML_E_EXPECTING_NDATA, // 70
  175. XML_E_INVALID_MODEL, // 71
  176. XML_E_INVALID_TYPE, // 72
  177. XML_E_INVALIDXMLSPACE, // 73
  178. XML_E_MULTI_ATTR_VALUE, // 74
  179. XML_E_INVALID_PRESENCE, // 75
  180. XML_E_BADXMLCASE, // 76
  181. XML_E_CONDSECTINSUBSET, // 77
  182. XML_E_CDATAINVALID, // 78
  183. XML_E_INVALID_STANDALONE, // 79
  184. XML_E_UNEXPECTED_STANDALONE, // 7A
  185. XML_E_DOCTYPE_IN_DTD, // 7B
  186. XML_E_MISSING_ENTITY, // 7C
  187. XML_E_ENTITYREF_INNAME, // 7D
  188. XML_E_DOCTYPE_OUTSIDE_PROLOG, // 7E
  189. XML_E_INVALID_VERSION, // 7F
  190. XML_E_DTDELEMENT_OUTSIDE_DTD, // 80
  191. XML_E_DUPLICATEDOCTYPE, // 81
  192. XML_E_RESOURCE, // 82
  193. XML_E_MISSINGNAME, // 83
  194. XML_E_LASTERROR,
  195. } XML_ERROR_CODE;
  196. // Possible ready states
  197. typedef enum
  198. {
  199. XMLPARSER_IDLE,
  200. XMLPARSER_WAITING,
  201. XMLPARSER_BUSY,
  202. XMLPARSER_ERROR,
  203. XMLPARSER_STOPPED,
  204. XMLPARSER_SUSPENDED
  205. } XML_PARSER_STATE;
  206. // Some parser flags which can be OR'd together.
  207. // By default all flags are clear.
  208. // DTD and ENTITY are mutually exclusive.
  209. typedef enum
  210. {
  211. XMLFLAG_FLOATINGAMP = 0x00000001,
  212. XMLFLAG_SHORTENDTAGS = 0x00000002,
  213. XMLFLAG_CASEINSENSITIVE = 0x00000004,
  214. XMLFLAG_NONAMESPACES = 0x00000008,
  215. XMLFLAG_NOWHITESPACE = 0x00000010,
  216. XMLFLAG_IE4QUIRKS = 0x00000020,
  217. XMLFLAG_NODTDNODES = 0x00000040,
  218. XMLFLAG_IE4COMPATIBILITY = 0x000000FF,
  219. XMLFLAG_IE5COMPATIBILITY = 0x00000100,
  220. XMLFLAG_SAX = 0x00000200,
  221. XMLFLAG_NORMALIZELB = 0x00000400,
  222. XMLFLAG_IGNOREENCODING = 0x00000800,
  223. XMLFLAG_USEWINHTTP = 0x00001000,
  224. XMLFLAG_RUNBUFFERONLY = 0x00002000,
  225. } XML_PARSER_FLAGS;
  226. // Some things that node factories can be notified of
  227. typedef enum
  228. {
  229. XMLNF_STARTDOCUMENT,
  230. XMLNF_STARTDTD,
  231. XMLNF_ENDDTD,
  232. XMLNF_STARTDTDSUBSET,
  233. XMLNF_ENDDTDSUBSET,
  234. XMLNF_ENDPROLOG,
  235. XMLNF_STARTENTITY,
  236. XMLNF_ENDENTITY,
  237. XMLNF_ENDDOCUMENT,
  238. XMLNF_DATAAVAILABLE,
  239. XMLNF_LASTEVENT = XMLNF_DATAAVAILABLE
  240. } XML_NODEFACTORY_EVENT;
  241. typedef struct _XML_NODE_INFO
  242. {
  243. DWORD dwSize; // size of this struct
  244. DWORD dwType; // node type (XML_NODE_TYPE)
  245. DWORD dwSubType; // node sub type (XML_NODE_SUBTYPE)
  246. BOOL fTerminal; // whether this node can have any children
  247. const WCHAR* pwcText; // element names, or text node contents.
  248. ULONG ulLen; // length of pwcText
  249. ULONG ulNsPrefixLen; // if element name, this is namespace prefix length.
  250. PVOID pNode; // optionally created by & returned from node factory
  251. PVOID pReserved; // reserved for factories to use between themselves.
  252. } XML_NODE_INFO;
  253. //------------------------------------------------------------------------
  254. // See http://xmlweb/msxml/xmlparser.htm for a description of this interface.
  255. [
  256. uuid(d242361c-51a0-11d2-9caf-0060b0ec3d39), // LIBID_XMLPARSER
  257. helpstring("Microsoft XML Parser 1.0"),
  258. lcid(0x0000),
  259. version(1.0)
  260. ]
  261. library XMLPSR
  262. {
  263. importlib("stdole32.tlb");
  264. importlib("stdole2.tlb");
  265. [
  266. object,
  267. local,
  268. uuid(d242361d-51a0-11d2-9caf-0060b0ec3d39), // IID_IXMLNodeSource
  269. helpstring("IXMLParser Interface"),
  270. pointer_default(unique)
  271. ]
  272. interface IXMLNodeSource : IUnknown
  273. {
  274. HRESULT SetFactory(
  275. [in] IXMLNodeFactory* pNodeFactory);
  276. HRESULT GetFactory(
  277. [out] IXMLNodeFactory** ppNodeFactory);
  278. HRESULT Abort(
  279. [in] BSTR bstrErrorInfo);
  280. ULONG GetLineNumber();
  281. ULONG GetLinePosition();
  282. ULONG GetAbsolutePosition();
  283. HRESULT GetLineBuffer(
  284. [out] const WCHAR** ppwcBuf,
  285. [out] ULONG* pulLen,
  286. [out] ULONG* pulStartPos);
  287. HRESULT GetLastError();
  288. HRESULT GetErrorInfo(
  289. [out] BSTR* pbstrErrorInfo);
  290. ULONG GetFlags();
  291. HRESULT GetURL(
  292. [out] const WCHAR** ppwcBuf);
  293. };
  294. [
  295. object,
  296. local,
  297. uuid(d242361e-51a0-11d2-9caf-0060b0ec3d39), // IID_IXMLParser
  298. helpstring("IXMLParser Interface"),
  299. pointer_default(unique)
  300. ]
  301. interface IXMLParser : IXMLNodeSource
  302. {
  303. HRESULT SetURL(
  304. [in] const WCHAR* pszBaseUrl,
  305. [in] const WCHAR* pszRelativeUrl,
  306. [in] BOOL fAsync);
  307. HRESULT Load(
  308. [in] BOOL fFullyAvailable,
  309. [in] IMoniker *pimkName,
  310. [in] LPBC pibc,
  311. [in] DWORD grfMode);
  312. HRESULT SetInput(
  313. [in] IUnknown *pStm);
  314. HRESULT PushData(
  315. [in] const char* pData,
  316. [in] ULONG ulChars,
  317. [in] BOOL fLastBuffer);
  318. HRESULT LoadDTD(
  319. [in] const WCHAR* pszBaseUrl,
  320. [in] const WCHAR* pszRelativeUrl);
  321. HRESULT LoadEntity(
  322. [in] const WCHAR* pszBaseUrl,
  323. [in] const WCHAR* pszRelativeUrl,
  324. [in] BOOL fpe);
  325. HRESULT ParseEntity(
  326. [in] const WCHAR* pwcText,
  327. [in] ULONG ulLen,
  328. [in] BOOL fpe);
  329. // Similar to parsing internal parameter entities, except
  330. // it doesn't insert any spaces. This is used to expand
  331. // named entities inside attribute values when DTD specifies
  332. // attribute type other than CDATA.
  333. HRESULT ExpandEntity(
  334. [in] const WCHAR* pwcText,
  335. [in] ULONG ulLen);
  336. HRESULT SetRoot(
  337. [in] PVOID pRoot);
  338. HRESULT GetRoot(
  339. [in] PVOID* ppRoot);
  340. HRESULT Run(
  341. [in] long lChars);
  342. HRESULT GetParserState();
  343. HRESULT Suspend();
  344. HRESULT Reset();
  345. HRESULT SetFlags(
  346. [in] ULONG iFlags);
  347. // This is used as a default if LoadDTD or LoadEntity or SetURL is called
  348. // with a NULL base URL.
  349. HRESULT SetSecureBaseURL(
  350. [in] const WCHAR* pszBaseUrl);
  351. HRESULT GetSecureBaseURL(
  352. [out] const WCHAR** ppwcBuf);
  353. };
  354. [
  355. object,
  356. local,
  357. uuid(d242361f-51a0-11d2-9caf-0060b0ec3d39), // IID_IXMLNodeFactory
  358. helpstring("IXMLNodeFactory Interface"),
  359. pointer_default(unique)
  360. ]
  361. interface IXMLNodeFactory : IUnknown
  362. {
  363. HRESULT NotifyEvent(
  364. [in] IXMLNodeSource* pSource,
  365. [in] XML_NODEFACTORY_EVENT iEvt);
  366. HRESULT BeginChildren(
  367. [in] IXMLNodeSource* pSource,
  368. [in] XML_NODE_INFO* pNodeInfo);
  369. HRESULT EndChildren(
  370. [in] IXMLNodeSource* pSource,
  371. [in] BOOL fEmpty,
  372. [in] XML_NODE_INFO* pNodeInfo);
  373. HRESULT Error(
  374. [in] IXMLNodeSource* pSource,
  375. [in] HRESULT hrErrorCode,
  376. [in] USHORT cNumRecs,
  377. [in] XML_NODE_INFO** apNodeInfo);
  378. HRESULT CreateNode(
  379. [in] IXMLNodeSource* pSource,
  380. [in] PVOID pNodeParent,
  381. [in] USHORT cNumRecs,
  382. [in] XML_NODE_INFO** apNodeInfo);
  383. };
  384. // XMLParser co-Class, version independent
  385. [
  386. uuid(f5078f19-c551-11d3-89b9-0000f81fe221), // CLSID_XMLParser
  387. helpstring("XML Parser (version independent) coclass")
  388. ]
  389. coclass XMLParser
  390. {
  391. [default] interface IXMLParser;
  392. };
  393. // XMLParser co-Class, 2.6 version dependent
  394. [
  395. uuid(f5078f20-c551-11d3-89b9-0000f81fe221), // CLSID_XMLParser26
  396. helpstring("XML Parser 2.6 coclass")
  397. ]
  398. coclass XMLParser26
  399. {
  400. [default] interface IXMLParser;
  401. };
  402. // XMLParser co-Class, 3.0 version dependent
  403. [
  404. uuid(f5078f31-c551-11d3-89b9-0000f81fe221), // CLSID_XMLParser30
  405. helpstring("XML Parser 3.0 coclass")
  406. ]
  407. coclass XMLParser30
  408. {
  409. [default] interface IXMLParser;
  410. };
  411. }