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.

497 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_IGNORESXMLDECL = 0x00000100,
  220. XMLFLAG_SAX = 0x00000200,
  221. XMLFLAG_NORMALIZELB = 0x00000400,
  222. XMLFLAG_IGNOREENCODING = 0x00000800,
  223. XMLFLAG_USEWINHTTP = 0x00001000,
  224. XMLFLAG_RUNBUFFERONLY = 0x00002000,
  225. XMLFLAG_LAZYRESYNC = 0x00004000,
  226. XMLFLAG_IGNOREILLEGALCHARS= 0x00010000,
  227. XMLFLAG_IE5COMPATIBILITY = 0x000F0100,
  228. } XML_PARSER_FLAGS;
  229. // Some things that node factories can be notified of
  230. typedef enum
  231. {
  232. XMLNF_STARTDOCUMENT,
  233. XMLNF_STARTDTD,
  234. XMLNF_ENDDTD,
  235. XMLNF_STARTDTDSUBSET,
  236. XMLNF_ENDDTDSUBSET,
  237. XMLNF_ENDPROLOG,
  238. XMLNF_STARTENTITY,
  239. XMLNF_ENDENTITY,
  240. XMLNF_ENDDOCUMENT,
  241. XMLNF_DATAAVAILABLE,
  242. XMLNF_LASTEVENT = XMLNF_DATAAVAILABLE
  243. } XML_NODEFACTORY_EVENT;
  244. typedef struct _XML_NODE_INFO
  245. {
  246. DWORD dwSize; // size of this struct
  247. DWORD dwType; // node type (XML_NODE_TYPE)
  248. DWORD dwSubType; // node sub type (XML_NODE_SUBTYPE)
  249. BOOL fTerminal; // whether this node can have any children
  250. const WCHAR* pwcText; // element names, or text node contents.
  251. ULONG ulLen; // length of pwcText
  252. ULONG ulNsPrefixLen; // if element name, this is namespace prefix length.
  253. PVOID pNode; // optionally created by & returned from node factory
  254. PVOID pReserved; // reserved for factories to use between themselves.
  255. } XML_NODE_INFO;
  256. //------------------------------------------------------------------------
  257. // See http://xmlweb/msxml/xmlparser.htm for a description of this interface.
  258. [
  259. uuid(d242361c-51a0-11d2-9caf-0060b0ec3d39), // LIBID_XMLPARSER
  260. helpstring("Microsoft XML Parser 1.0"),
  261. lcid(0x0000),
  262. version(1.0)
  263. ]
  264. library XMLPSR
  265. {
  266. importlib("stdole32.tlb");
  267. importlib("stdole2.tlb");
  268. [
  269. object,
  270. local,
  271. uuid(d242361d-51a0-11d2-9caf-0060b0ec3d39), // IID_IXMLNodeSource
  272. helpstring("IXMLParser Interface"),
  273. pointer_default(unique)
  274. ]
  275. interface IXMLNodeSource : IUnknown
  276. {
  277. HRESULT SetFactory(
  278. [in] IXMLNodeFactory* pNodeFactory);
  279. HRESULT GetFactory(
  280. [out] IXMLNodeFactory** ppNodeFactory);
  281. HRESULT Abort(
  282. [in] BSTR bstrErrorInfo);
  283. ULONG GetLineNumber();
  284. ULONG GetLinePosition();
  285. ULONG GetAbsolutePosition();
  286. HRESULT GetLineBuffer(
  287. [out] const WCHAR** ppwcBuf,
  288. [out] ULONG* pulLen,
  289. [out] ULONG* pulStartPos);
  290. HRESULT GetLastError();
  291. HRESULT GetErrorInfo(
  292. [out] BSTR* pbstrErrorInfo);
  293. ULONG GetFlags();
  294. HRESULT GetURL(
  295. [out] const WCHAR** ppwcBuf);
  296. };
  297. [
  298. object,
  299. local,
  300. uuid(d242361e-51a0-11d2-9caf-0060b0ec3d39), // IID_IXMLParser
  301. helpstring("IXMLParser Interface"),
  302. pointer_default(unique)
  303. ]
  304. interface IXMLParser : IXMLNodeSource
  305. {
  306. HRESULT SetURL(
  307. [in] const WCHAR* pszBaseUrl,
  308. [in] const WCHAR* pszRelativeUrl,
  309. [in] BOOL fAsync);
  310. HRESULT Load(
  311. [in] BOOL fFullyAvailable,
  312. [in] IMoniker *pimkName,
  313. [in] LPBC pibc,
  314. [in] DWORD grfMode);
  315. HRESULT SetInput(
  316. [in] IUnknown *pStm);
  317. HRESULT PushData(
  318. [in] const char* pData,
  319. [in] ULONG ulChars,
  320. [in] BOOL fLastBuffer);
  321. HRESULT LoadDTD(
  322. [in] const WCHAR* pszBaseUrl,
  323. [in] const WCHAR* pszRelativeUrl);
  324. HRESULT LoadEntity(
  325. [in] const WCHAR* pszBaseUrl,
  326. [in] const WCHAR* pszRelativeUrl,
  327. [in] BOOL fpe);
  328. HRESULT ParseEntity(
  329. [in] const WCHAR* pwcText,
  330. [in] ULONG ulLen,
  331. [in] BOOL fpe);
  332. // Similar to parsing internal parameter entities, except
  333. // it doesn't insert any spaces. This is used to expand
  334. // named entities inside attribute values when DTD specifies
  335. // attribute type other than CDATA.
  336. HRESULT ExpandEntity(
  337. [in] const WCHAR* pwcText,
  338. [in] ULONG ulLen);
  339. HRESULT SetRoot(
  340. [in] PVOID pRoot);
  341. HRESULT GetRoot(
  342. [in] PVOID* ppRoot);
  343. HRESULT Run(
  344. [in] long lChars);
  345. HRESULT GetParserState();
  346. HRESULT Suspend();
  347. HRESULT Reset();
  348. HRESULT SetFlags(
  349. [in] ULONG iFlags);
  350. // This is used as a default if LoadDTD or LoadEntity or SetURL is called
  351. // with a NULL base URL.
  352. HRESULT SetSecureBaseURL(
  353. [in] const WCHAR* pszBaseUrl);
  354. HRESULT GetSecureBaseURL(
  355. [out] const WCHAR** ppwcBuf);
  356. };
  357. [
  358. object,
  359. local,
  360. uuid(50fb5b1a-a75c-4ff4-86b2-14c62189e2cc), // IID_IXMLParser2
  361. helpstring("IXMLParser2 Interface"),
  362. pointer_default(unique)
  363. ]
  364. interface IXMLParser2 : IXMLParser
  365. {
  366. HRESULT SetMaxXmlSize(
  367. [in] ULONG MaxSizeCch);
  368. HRESULT GetMaxXmlSize(
  369. [out] ULONG * MaxSizeCch);
  370. };
  371. [
  372. object,
  373. local,
  374. uuid(d242361f-51a0-11d2-9caf-0060b0ec3d39), // IID_IXMLNodeFactory
  375. helpstring("IXMLNodeFactory Interface"),
  376. pointer_default(unique)
  377. ]
  378. interface IXMLNodeFactory : IUnknown
  379. {
  380. HRESULT NotifyEvent(
  381. [in] IXMLNodeSource* pSource,
  382. [in] XML_NODEFACTORY_EVENT iEvt);
  383. HRESULT BeginChildren(
  384. [in] IXMLNodeSource* pSource,
  385. [in] XML_NODE_INFO* pNodeInfo);
  386. HRESULT EndChildren(
  387. [in] IXMLNodeSource* pSource,
  388. [in] BOOL fEmpty,
  389. [in] XML_NODE_INFO* pNodeInfo);
  390. HRESULT Error(
  391. [in] IXMLNodeSource* pSource,
  392. [in] HRESULT hrErrorCode,
  393. [in] USHORT cNumRecs,
  394. [in] XML_NODE_INFO** apNodeInfo);
  395. HRESULT CreateNode(
  396. [in] IXMLNodeSource* pSource,
  397. [in] PVOID pNodeParent,
  398. [in] USHORT cNumRecs,
  399. [in] XML_NODE_INFO** apNodeInfo);
  400. };
  401. // XMLParser co-Class, version independent
  402. [
  403. uuid(f5078f19-c551-11d3-89b9-0000f81fe221), // CLSID_XMLParser
  404. helpstring("XML Parser (version independent) coclass")
  405. ]
  406. coclass XMLParser
  407. {
  408. [default] interface IXMLParser;
  409. };
  410. // XMLParser co-Class, 2.6 version dependent
  411. [
  412. uuid(f5078f20-c551-11d3-89b9-0000f81fe221), // CLSID_XMLParser26
  413. helpstring("XML Parser 2.6 coclass")
  414. ]
  415. coclass XMLParser26
  416. {
  417. [default] interface IXMLParser;
  418. };
  419. // XMLParser co-Class, 3.0 version dependent
  420. [
  421. uuid(f5078f31-c551-11d3-89b9-0000f81fe221), // CLSID_XMLParser30
  422. helpstring("XML Parser 3.0 coclass")
  423. ]
  424. coclass XMLParser30
  425. {
  426. [default] interface IXMLParser;
  427. };
  428. }