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 cpp_quote
("typedef enum XmlReadState")
84 cpp_quote
(" XmlReadState_Initial = 0,")
85 cpp_quote
(" XmlReadState_Interactive = 1,")
86 cpp_quote
(" XmlReadState_Error = 2,")
87 cpp_quote
(" XmlReadState_EndOfFile = 3,")
88 cpp_quote
(" XmlReadState_Closed = 4")
89 cpp_quote
("} XmlReadState;")
91 /* conformance levels */
92 cpp_quote
("typedef enum XmlConformanceLevel")
94 cpp_quote
(" XmlConformanceLevel_Auto = 0,")
95 cpp_quote
(" XmlConformanceLevel_Fragment = 1,")
96 cpp_quote
(" XmlConformanceLevel_Document = 2,")
97 cpp_quote
(" _XmlConformanceLevel_Last = 2")
98 cpp_quote
("} XmlConformanceLevel;")
100 /* DTD processing mode */
101 cpp_quote
("typedef enum DtdProcessing")
103 cpp_quote
(" DtdProcessing_Prohibit = 0,")
104 cpp_quote
(" DtdProcessing_Parse = DtdProcessing_Prohibit + 1,")
105 cpp_quote
(" _DtdProcessing_Last = DtdProcessing_Parse")
106 cpp_quote
("} DtdProcessing;")
108 /* IXmlReader properties */
109 cpp_quote
("typedef enum XmlReaderProperty")
111 cpp_quote
(" XmlReaderProperty_MultiLanguage = 0,")
112 cpp_quote
(" XmlReaderProperty_ConformanceLevel = XmlReaderProperty_MultiLanguage + 1,")
113 cpp_quote
(" XmlReaderProperty_RandomAccess = XmlReaderProperty_ConformanceLevel + 1,")
114 cpp_quote
(" XmlReaderProperty_XmlResolver = XmlReaderProperty_RandomAccess + 1,")
115 cpp_quote
(" XmlReaderProperty_DtdProcessing = XmlReaderProperty_XmlResolver + 1,")
116 cpp_quote
(" XmlReaderProperty_ReadState = XmlReaderProperty_DtdProcessing + 1,")
117 cpp_quote
(" XmlReaderProperty_MaxElementDepth = XmlReaderProperty_ReadState + 1,")
118 cpp_quote
(" XmlReaderProperty_MaxEntityExpansion = XmlReaderProperty_MaxElementDepth + 1,")
119 cpp_quote
(" _XmlReaderProperty_Last = XmlReaderProperty_MaxEntityExpansion")
120 cpp_quote
("} XmlReaderProperty;")
122 /* IXmlReader construction */
123 cpp_quote
("STDAPI CreateXmlReader(REFIID riid, void **ppvObject, IMalloc *pMalloc);")
125 cpp_quote
("typedef IUnknown IXmlReaderInput;")
126 cpp_quote
("STDAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream, IMalloc *pMalloc,")
127 cpp_quote
(" LPCWSTR encoding, BOOL hint,")
128 cpp_quote
(" LPCWSTR base_uri, IXmlReaderInput **ppInput);")
130 typedef enum XmlStandalone
135 _XmlStandalone_Last
= XmlStandalone_No
138 typedef enum XmlWriterProperty
140 XmlWriterProperty_MultiLanguage
,
141 XmlWriterProperty_Indent
,
142 XmlWriterProperty_ByteOrderMark
,
143 XmlWriterProperty_OmitXmlDeclaration
,
144 XmlWriterProperty_ConformanceLevel
,
145 _XmlWriterProperty_Last
= XmlWriterProperty_OmitXmlDeclaration
152 uuid(7279FC88
-709D
-4095-B63D
-69FE4B0D9030
),
153 pointer_default(unique)
155 interface IXmlWriter
: IUnknown
157 HRESULT SetOutput
([in] IUnknown
*pOutput
);
158 HRESULT GetProperty
([in] UINT nProperty
, [out] LONG_PTR
*ppValue
);
159 HRESULT SetProperty
([in] UINT nProperty
, [in] LONG_PTR pValue
);
160 HRESULT WriteAttributes
([in] IXmlReader
*pReader
, [in] BOOL fWriteDefaultAttributes
);
161 HRESULT WriteAttributeString
([in] LPCWSTR pwszPrefix
, [in] LPCWSTR pwszLocalName
,
162 [in] LPCWSTR pwszNamespaceUri
, [in] LPCWSTR pwszValue
);
163 HRESULT WriteCData
([in] LPCWSTR pwszText
);
164 HRESULT WriteCharEntity
([in] WCHAR wch
);
165 HRESULT WriteChars
([in] const WCHAR
*pwch
, [in] UINT cwch
);
166 HRESULT WriteComment
([in] LPCWSTR pwszComment
);
167 HRESULT WriteDocType
([in] LPCWSTR pwszName
, [in] LPCWSTR pwszPublicId
,
168 [in] LPCWSTR pwszSystemId
, [in] LPCWSTR pwszSubset
);
169 HRESULT WriteElementString
([in] LPCWSTR pwszPrefix
, [in] LPCWSTR pwszLocalName
,
170 [in] LPCWSTR pwszNamespaceUri
, [in] LPCWSTR pwszValue
);
171 HRESULT WriteEndDocument
();
172 HRESULT WriteEndElement
();
173 HRESULT WriteEntityRef
([in] LPCWSTR pwszName
);
174 HRESULT WriteFullEndElement
();
175 HRESULT WriteName
([in] LPCWSTR pwszName
);
176 HRESULT WriteNmToken
([in] LPCWSTR pwszNmToken
);
177 HRESULT WriteNode
([in] IXmlReader
*pReader
, [in] BOOL fWriteDefaultAttributes
);
178 HRESULT WriteNodeShallow
([in] IXmlReader
*pReader
, [in] BOOL fWriteDefaultAttributes
);
179 HRESULT WriteProcessingInstruction
([in] LPCWSTR pwszName
, [in] LPCWSTR pwszText
);
180 HRESULT WriteQualifiedName
([in] LPCWSTR pwszLocalName
, [in] LPCWSTR pwszNamespaceUri
);
181 HRESULT WriteRaw
([in] LPCWSTR pwszData
);
182 HRESULT WriteRawChars
([in] const WCHAR
*pwch
, [in] UINT cwch
);
183 HRESULT WriteStartDocument
([in] XmlStandalone standalone
);
184 HRESULT WriteStartElement
([in] LPCWSTR pwszPrefix
, [in] LPCWSTR pwszLocalName
,
185 [in] LPCWSTR pwszNamespaceUri
);
186 HRESULT WriteString
([in] LPCWSTR pwszText
);
187 HRESULT WriteSurrogateCharEntity
([in] WCHAR wchLow
, [in] WCHAR wchHigh
);
188 HRESULT WriteWhitespace
([in] LPCWSTR pwszWhitespace
);