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.

349 lines
8.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. xml.h
  5. Abstract:
  6. Declares the interfaces for the COM XML interface wrapper library.
  7. Author:
  8. Jim Schmidt (jimschm) 31-Jan-2001
  9. Revision History:
  10. <alias> <date> <comments>
  11. --*/
  12. #pragma once
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #include <oleauto.h>
  17. typedef struct { BOOL Dummy; } * PXMLDOC;
  18. typedef enum {
  19. XMLNODE_PREFIX = 0x0001, // XML syntax is <prefix:basename>
  20. XMLNODE_BASENAME = 0x0002,
  21. XMLNODE_TEXT = 0x0004, // all text contained in the node's subtree
  22. XMLNODE_NAMESPACE_URI = 0x0008, // xmlns:nnn=namespace_uri such as
  23. // "urn:schemas-microsoft-com:xml-data"
  24. XMLNODE_TYPESTRING = 0x0010, // the node type, in a string format
  25. XMLNODE_VALUE = 0x0020 // depending on node type, returns attribute value,
  26. // comments, CDATA, processing instruction or text
  27. } XMLNODE_MEMBERS;
  28. #define XMLNODE_ALL 0xFFFF
  29. typedef struct {
  30. PCSTR Prefix;
  31. PCSTR BaseName;
  32. PCSTR Text;
  33. PCSTR NamespaceUri;
  34. PCSTR TypeString;
  35. VARIANT Value;
  36. PCSTR ValueString; // filled when Value is filled
  37. } XMLNODEA, *PXMLNODEA;
  38. typedef struct {
  39. PCWSTR Prefix;
  40. PCWSTR BaseName;
  41. PCWSTR Text;
  42. PCWSTR NamespaceUri;
  43. PCWSTR TypeString;
  44. VARIANT Value;
  45. PCWSTR ValueString; // filled when Value is filled
  46. } XMLNODEW, *PXMLNODEW;
  47. //
  48. // This enum is used to filter nodes by screening IXMLDOMNodeType.
  49. // IXMLDOMNodeType is a constant from 1 to 12, but we want a bitmap.
  50. //
  51. typedef enum {
  52. XMLFILTER_ELEMENTS = 0x00000001,
  53. XMLFILTER_ATTRIBUTES = 0x00000002,
  54. XMLFILTER_TEXT = 0x00000004,
  55. XMLFILTER_CDATA = 0x00000008,
  56. XMLFILTER_ENTITY_REFERENCE = 0x00000010,
  57. XMLFILTER_ENTITY = 0x00000020,
  58. XMLFILTER_NODE_PROCESSING_INSTRUCTION = 0x00000040,
  59. XMLFILTER_COMMENT = 0x00000080,
  60. XMLFILTER_DOCUMENT = 0x00000100,
  61. XMLFILTER_DOCUMENT_TYPE = 0x00000200,
  62. XMLFILTER_DOCUMENT_FRAGMENT = 0x00000400,
  63. XMLFILTER_NODE_NOTATION = 0x00000800,
  64. XMLFILTER_PARENT_ATTRIBUTES = 0x10000000,
  65. XMLFILTER_NO_ELEMENT_SUBENUM = 0x20000000
  66. } XMLFILTERFLAGS;
  67. #define XMLFILTER_ALL ((XMLFILTERFLAGS) 0xffff)
  68. #define XMLFILTER_ELEMENT_ATTRIBUTES ((XMLFILTERFLAGS) (XMLFILTER_ATTRIBUTES|XMLFILTER_PARENT_ATTRIBUTES|XMLFILTER_NO_ELEMENT_SUBENUM))
  69. //
  70. // Define a constant that indicates what the max # is for NODE_* flags
  71. // from the DOM. It is assumed that NODE_* constants are ordered from
  72. // 1 to 12, and since we have a bitmap, we convert the constants with
  73. // 2 ^ (constant - 1). Constants > NUMBER_OF_FLAGS are ignored.
  74. //
  75. #define NUMBER_OF_FLAGS 12
  76. typedef struct {
  77. // output of enum
  78. PXMLNODEA CurrentNode;
  79. // internal use only
  80. PVOID Reserved;
  81. } XMLNODE_ENUMA, *PXMLNODE_ENUMA;
  82. typedef struct {
  83. // output of enum
  84. PXMLNODEW CurrentNode;
  85. // internal use only
  86. PVOID Reserved;
  87. } XMLNODE_ENUMW, *PXMLNODE_ENUMW;
  88. //
  89. // Library routines
  90. //
  91. BOOL
  92. XmlInitialize (
  93. VOID
  94. );
  95. #undef INITIALIZE_XML_CODE
  96. #define INITIALIZE_XML_CODE if (!XmlInitialize()) { __leave; }
  97. VOID
  98. XmlTerminate (
  99. VOID
  100. );
  101. #undef TERMINATE_XML_CODE
  102. #define TERMINATE_XML_CODE XmlTerminate();
  103. //
  104. // XML file routines
  105. //
  106. PXMLDOC
  107. XmlOpenFileA (
  108. IN PCSTR XmlFileName,
  109. IN PCSTR SchemaFileName OPTIONAL
  110. );
  111. PXMLDOC
  112. XmlOpenFileW (
  113. IN PCWSTR XmlFileName,
  114. IN PCWSTR SchemaFileName OPTIONAL
  115. );
  116. VOID
  117. XmlCloseFile (
  118. IN OUT PXMLDOC *XmlDoc
  119. );
  120. //
  121. // Node manipulation
  122. //
  123. BOOL
  124. XmlFillNodeA (
  125. IN OUT PXMLNODEA XmlNode,
  126. IN XMLNODE_MEMBERS Flags
  127. );
  128. BOOL
  129. XmlFillNodeW (
  130. IN OUT PXMLNODEW XmlNode,
  131. IN XMLNODE_MEMBERS Flags
  132. );
  133. PXMLNODEA
  134. XmlDuplicateNodeA (
  135. IN PXMLNODEA XmlNode
  136. );
  137. PXMLNODEW
  138. XmlDuplicateNodeW (
  139. IN PXMLNODEW XmlNode
  140. );
  141. VOID
  142. XmlFreeNodeA (
  143. IN PXMLNODEA XmlNode
  144. );
  145. VOID
  146. XmlFreeNodeW (
  147. IN PXMLNODEW XmlNode
  148. );
  149. //
  150. // XML document enumeration
  151. //
  152. BOOL
  153. XmlEnumFirstNodeA (
  154. OUT PXMLNODE_ENUMA EnumPtr,
  155. IN PXMLDOC XmlDocPtr, OPTIONAL
  156. IN PXMLNODEA Parent, OPTIONAL
  157. IN XMLFILTERFLAGS FilterFlags
  158. );
  159. BOOL
  160. XmlEnumFirstNodeW (
  161. OUT PXMLNODE_ENUMW EnumPtr,
  162. IN PXMLDOC XmlDocPtr, OPTIONAL
  163. IN PXMLNODEW Parent, OPTIONAL
  164. IN XMLFILTERFLAGS FilterFlags
  165. );
  166. BOOL
  167. XmlEnumNextNodeA (
  168. IN OUT PXMLNODE_ENUMA EnumPtr
  169. );
  170. BOOL
  171. XmlEnumNextNodeW (
  172. IN OUT PXMLNODE_ENUMW EnumPtr
  173. );
  174. VOID
  175. XmlAbortNodeEnumA (
  176. IN PXMLNODE_ENUMA EnumPtr ZEROED
  177. );
  178. VOID
  179. XmlAbortNodeEnumW (
  180. IN PXMLNODE_ENUMW EnumPtr ZEROED
  181. );
  182. PXMLNODEA
  183. XmlGetSchemaDefinitionNodeA (
  184. IN PXMLNODEA Node
  185. );
  186. PXMLNODEW
  187. XmlGetSchemaDefinitionNodeW (
  188. IN PXMLNODEW Node
  189. );
  190. PCSTR
  191. XmlGetAttributeA (
  192. IN PXMLNODEA Node,
  193. IN PCSTR AttributeName
  194. );
  195. PCWSTR
  196. XmlGetAttributeW (
  197. IN PXMLNODEW Node,
  198. IN PCWSTR AttributeName
  199. );
  200. typedef struct {
  201. PCSTR AttributeName;
  202. PCSTR ValueString;
  203. } XMLATTRIBUTEA, *PXMLATTRIBUTEA;
  204. typedef struct {
  205. PCWSTR AttributeName;
  206. PCWSTR ValueString;
  207. } XMLATTRIBUTEW, *PXMLATTRIBUTEW;
  208. INT
  209. XmlFillAttributeListA (
  210. IN PXMLNODEA ElementNode,
  211. IN OUT PXMLATTRIBUTEA List,
  212. IN UINT ListLength
  213. );
  214. INT
  215. XmlFillAttributeListW (
  216. IN PXMLNODEW ElementNode,
  217. IN OUT PXMLATTRIBUTEW List,
  218. IN UINT ListLength
  219. );
  220. VOID
  221. XmlResetAttributeListA (
  222. IN OUT PXMLATTRIBUTEA List,
  223. IN UINT ListLength
  224. );
  225. VOID
  226. XmlResetAttributeListW (
  227. IN OUT PXMLATTRIBUTEW List,
  228. IN UINT ListLength
  229. );
  230. #ifdef UNICODE
  231. #define XmlOpenFile XmlOpenFileW
  232. #define XmlFillNode XmlFillNodeW
  233. #define XmlDuplicateNode XmlDuplicateNodeW
  234. #define XmlFreeNode XmlFreeNodeW
  235. #define XmlEnumFirstNode XmlEnumFirstNodeW
  236. #define XmlEnumNextNode XmlEnumNextNodeW
  237. #define XmlAbortNodeEnum XmlAbortNodeEnumW
  238. #define XmlGetSchemaDefinitionNode XmlGetSchemaDefinitionNodeW
  239. #define XmlGetAttribute XmlGetAttributeW
  240. #define XmlFillAttributeList XmlFillAttributeListW
  241. #define XmlResetAttributeList XmlResetAttributeListW
  242. #define XMLNODE_ENUM XMLNODE_ENUMW
  243. #define PXMLNODE_ENUM PXMLNODE_ENUMW
  244. #define XMLNODE XMLNODEW
  245. #define PXMLNODE PXMLNODEW
  246. #define XMLATTRIBUTE XMLATTRIBUTEW
  247. #define PXMLATTRIBUTE PXMLATTRIBUTEW
  248. #else
  249. #define XmlOpenFile XmlOpenFileA
  250. #define XmlFillNode XmlFillNodeA
  251. #define XmlDuplicateNode XmlDuplicateNodeA
  252. #define XmlFreeNode XmlFreeNodeA
  253. #define XmlEnumFirstNode XmlEnumFirstNodeA
  254. #define XmlEnumNextNode XmlEnumNextNodeA
  255. #define XmlAbortNodeEnum XmlAbortNodeEnumA
  256. #define XmlGetSchemaDefinitionNode XmlGetSchemaDefinitionNodeA
  257. #define XmlGetAttribute XmlGetAttributeA
  258. #define XmlFillAttributeList XmlFillAttributeListA
  259. #define XmlResetAttributeList XmlResetAttributeListA
  260. #define XMLNODE_ENUM XMLNODE_ENUMA
  261. #define PXMLNODE_ENUM PXMLNODE_ENUMA
  262. #define XMLNODE XMLNODEA
  263. #define PXMLNODE PXMLNODEA
  264. #define XMLATTRIBUTE XMLATTRIBUTEA
  265. #define PXMLATTRIBUTE PXMLATTRIBUTEA
  266. #endif
  267. #ifdef __cplusplus
  268. }
  269. #endif