2 * Copyright (C) 2010 Nikolay Sivov
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 typedef enum XmlNodeType {
25 XmlNodeType_Element = 1,
26 XmlNodeType_Attribute = 2,
28 XmlNodeType_CDATA = 4,
29 XmlNodeType_ProcessingInstruction = 7,
30 XmlNodeType_Comment = 8,
31 XmlNodeType_DocumentType = 10,
32 XmlNodeType_Whitespace = 13,
33 XmlNodeType_EndElement = 15,
34 XmlNodeType_XmlDeclaration = 17,
35 _XmlNodeType_Last = 17
42 uuid(7279fc81-709d-4095-b63d-69fe4b0d9030),
43 pointer_default(unique)
45 interface IXmlReader : IUnknown
47 HRESULT SetInput( [in] IUnknown *input);
48 HRESULT GetProperty( [in] UINT property, [out] LONG_PTR *value);
49 HRESULT SetProperty( [in] UINT property, [in] LONG_PTR value);
50 HRESULT Read( [out] XmlNodeType *node_type);
51 HRESULT GetNodeType( [out] XmlNodeType *node_type);
52 HRESULT MoveToFirstAttribute(void);
53 HRESULT MoveToNextAttribute(void);
54 HRESULT MoveToAttributeByName( [in] LPCWSTR local_name,
55 [in] LPCWSTR namespaceUri);
56 HRESULT MoveToElement(void);
57 HRESULT GetQualifiedName( [out] LPCWSTR *qualifiedName,
58 [out] UINT *qualifiedName_length);
59 HRESULT GetNamespaceUri( [out] LPCWSTR *namespaceUri,
60 [out] UINT *nnamespaceUri_length);
61 HRESULT GetLocalName( [out] LPCWSTR *local_name,
62 [out] UINT *locale_name_length);
63 HRESULT GetPrefix( [out] LPCWSTR *prefix,
64 [out] UINT *prefix_length);
65 HRESULT GetValue( [out] LPCWSTR *value,
66 [out] UINT *value_length);
67 HRESULT ReadValueChunk( [out] WCHAR *buffer,
70 HRESULT GetBaseUri( [out] LPCWSTR *baseUri,
71 [out] UINT *baseUri_length);
73 BOOL IsEmptyElement(void);
74 HRESULT GetLineNumber( [out] UINT *lineNumber);
75 HRESULT GetLinePosition( [out] UINT *linePosition);
76 HRESULT GetAttributeCount( [out] UINT *attributeCount);
77 HRESULT GetDepth( [out] UINT *depth);
81 /* IXmlReader state */
82 typedef enum XmlReadState
85 XmlReadState_Interactive,
87 XmlReadState_EndOfFile,
91 /* conformance levels */
92 typedef enum XmlConformanceLevel
94 XmlConformanceLevel_Auto,
95 XmlConformanceLevel_Fragment,
96 XmlConformanceLevel_Document,
97 _XmlConformanceLevel_Last = XmlConformanceLevel_Document
98 } XmlConformanceLevel;
100 /* DTD processing mode */
101 typedef enum DtdProcessing
103 DtdProcessing_Prohibit,
105 _DtdProcessing_Last = DtdProcessing_Parse
108 /* IXmlReader properties */
109 typedef enum XmlReaderProperty
111 XmlReaderProperty_MultiLanguage,
112 XmlReaderProperty_ConformanceLevel,
113 XmlReaderProperty_RandomAccess,
114 XmlReaderProperty_XmlResolver,
115 XmlReaderProperty_DtdProcessing,
116 XmlReaderProperty_ReadState,
117 XmlReaderProperty_MaxElementDepth,
118 XmlReaderProperty_MaxEntityExpansion,
119 _XmlReaderProperty_Last = XmlReaderProperty_MaxEntityExpansion
122 /* reader error codes */
123 typedef enum XmlError
125 MX_E_MX = 0xc00cee00,
129 MX_E_ENCODINGSIGNATURE,
130 WC_E_WC = 0xc00cee20,
158 WC_E_UNIQUEATTRIBUTE,
165 WC_E_PESINTERNALSUBSET,
166 WC_E_PESBETWEENDECLS,
169 WC_E_UNDECLAREDENTITY,
171 WC_E_NOEXTERNALENTITYREF,
178 WC_E_INVALIDXMLSPACE,
179 NC_E_NC = 0xc00cee60,
184 NC_E_UNDECLAREDPREFIX,
186 NC_E_XMLPREFIXRESERVED,
187 NC_E_XMLNSPREFIXRESERVED,
189 NC_E_XMLNSURIRESERVED,
190 SC_E_SC = 0xc00cee80,
191 SC_E_MAXELEMENTDEPTH,
192 SC_E_MAXENTITYEXPANSION,
193 WR_E_WR = 0xc00cef00,
195 WR_E_NSPREFIXDECLARED,
196 WR_E_NSPREFIXWITHEMPTYNSURI,
197 WR_E_DUPLICATEATTRIBUTE,
198 WR_E_XMLNSPREFIXDECLARATION,
199 WR_E_XMLPREFIXDECLARATION,
200 WR_E_XMLURIDECLARATION,
201 WR_E_XMLNSURIDECLARATION,
202 WR_E_NAMESPACEUNDECLARED,
203 WR_E_INVALIDXMLSPACE,
205 WR_E_INVALIDSURROGATEPAIR,
206 XML_E_INVALID_DECIMAL = 0xc00ce01d,
207 XML_E_INVALID_HEXIDECIMAL,
208 XML_E_INVALID_UNICODE,
209 XML_E_INVALIDENCODING = 0xc00ce06e
212 /* IXmlReader construction */
213 cpp_quote("STDAPI CreateXmlReader(REFIID riid, void **ppvObject, IMalloc *pMalloc);")
215 cpp_quote("typedef IUnknown IXmlReaderInput;")
216 cpp_quote("STDAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream, IMalloc *pMalloc,")
217 cpp_quote(" LPCWSTR encoding, BOOL hint,")
218 cpp_quote(" LPCWSTR base_uri, IXmlReaderInput **ppInput);")
220 typedef enum XmlStandalone
225 _XmlStandalone_Last = XmlStandalone_No
228 typedef enum XmlWriterProperty
230 XmlWriterProperty_MultiLanguage,
231 XmlWriterProperty_Indent,
232 XmlWriterProperty_ByteOrderMark,
233 XmlWriterProperty_OmitXmlDeclaration,
234 XmlWriterProperty_ConformanceLevel,
235 _XmlWriterProperty_Last = XmlWriterProperty_OmitXmlDeclaration
242 uuid(7279FC88-709D-4095-B63D-69FE4B0D9030),
243 pointer_default(unique)
245 interface IXmlWriter : IUnknown
247 HRESULT SetOutput([in] IUnknown *pOutput);
248 HRESULT GetProperty([in] UINT nProperty, [out] LONG_PTR *ppValue);
249 HRESULT SetProperty([in] UINT nProperty, [in] LONG_PTR pValue);
250 HRESULT WriteAttributes([in] IXmlReader *pReader, [in] BOOL fWriteDefaultAttributes);
251 HRESULT WriteAttributeString([in] LPCWSTR pwszPrefix, [in] LPCWSTR pwszLocalName,
252 [in] LPCWSTR pwszNamespaceUri, [in] LPCWSTR pwszValue);
253 HRESULT WriteCData([in] LPCWSTR pwszText);
254 HRESULT WriteCharEntity([in] WCHAR wch);
255 HRESULT WriteChars([in] const WCHAR *pwch, [in] UINT cwch);
256 HRESULT WriteComment([in] LPCWSTR pwszComment);
257 HRESULT WriteDocType([in] LPCWSTR pwszName, [in] LPCWSTR pwszPublicId,
258 [in] LPCWSTR pwszSystemId, [in] LPCWSTR pwszSubset);
259 HRESULT WriteElementString([in] LPCWSTR pwszPrefix, [in] LPCWSTR pwszLocalName,
260 [in] LPCWSTR pwszNamespaceUri, [in] LPCWSTR pwszValue);
261 HRESULT WriteEndDocument();
262 HRESULT WriteEndElement();
263 HRESULT WriteEntityRef([in] LPCWSTR pwszName);
264 HRESULT WriteFullEndElement();
265 HRESULT WriteName([in] LPCWSTR pwszName);
266 HRESULT WriteNmToken([in] LPCWSTR pwszNmToken);
267 HRESULT WriteNode([in] IXmlReader *pReader, [in] BOOL fWriteDefaultAttributes);
268 HRESULT WriteNodeShallow([in] IXmlReader *pReader, [in] BOOL fWriteDefaultAttributes);
269 HRESULT WriteProcessingInstruction([in] LPCWSTR pwszName, [in] LPCWSTR pwszText);
270 HRESULT WriteQualifiedName([in] LPCWSTR pwszLocalName, [in] LPCWSTR pwszNamespaceUri);
271 HRESULT WriteRaw([in] LPCWSTR pwszData);
272 HRESULT WriteRawChars([in] const WCHAR *pwch, [in] UINT cwch);
273 HRESULT WriteStartDocument([in] XmlStandalone standalone);
274 HRESULT WriteStartElement([in] LPCWSTR pwszPrefix, [in] LPCWSTR pwszLocalName,
275 [in] LPCWSTR pwszNamespaceUri);
276 HRESULT WriteString([in] LPCWSTR pwszText);
277 HRESULT WriteSurrogateCharEntity([in] WCHAR wchLow, [in] WCHAR wchHigh);
278 HRESULT WriteWhitespace([in] LPCWSTR pwszWhitespace);