| 1 | /* | 
|---|
| 2 | * Copyright (C) 2010 Nikolay Sivov | 
|---|
| 3 | * | 
|---|
| 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. | 
|---|
| 8 | * | 
|---|
| 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. | 
|---|
| 13 | * | 
|---|
| 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 | 
|---|
| 17 | */ | 
|---|
| 18 |  | 
|---|
| 19 | import "unknwn.idl"; | 
|---|
| 20 | import "objidl.idl"; | 
|---|
| 21 | import "oaidl.idl"; | 
|---|
| 22 |  | 
|---|
| 23 | typedef enum XmlNodeType { | 
|---|
| 24 | XmlNodeType_None                  = 0, | 
|---|
| 25 | XmlNodeType_Element               = 1, | 
|---|
| 26 | XmlNodeType_Attribute             = 2, | 
|---|
| 27 | XmlNodeType_Text                  = 3, | 
|---|
| 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 | 
|---|
| 36 | } XmlNodeType; | 
|---|
| 37 |  | 
|---|
| 38 | /* IXmlReader */ | 
|---|
| 39 | [ | 
|---|
| 40 | local, | 
|---|
| 41 | object, | 
|---|
| 42 | uuid(7279fc81-709d-4095-b63d-69fe4b0d9030), | 
|---|
| 43 | pointer_default(unique) | 
|---|
| 44 | ] | 
|---|
| 45 | interface IXmlReader : IUnknown | 
|---|
| 46 | { | 
|---|
| 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, | 
|---|
| 68 | [in]  UINT chunk_size, | 
|---|
| 69 | [in,out] UINT *read); | 
|---|
| 70 | HRESULT GetBaseUri( [out] LPCWSTR *baseUri, | 
|---|
| 71 | [out] UINT *baseUri_length); | 
|---|
| 72 | BOOL IsDefault(void); | 
|---|
| 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); | 
|---|
| 78 | BOOL IsEOF(void); | 
|---|
| 79 | } | 
|---|
| 80 |  | 
|---|
| 81 | /* IXmlResolver */ | 
|---|
| 82 | [ | 
|---|
| 83 | local, | 
|---|
| 84 | object, | 
|---|
| 85 | uuid(7279fc82-709d-4095-b63d-69fe4b0d9030), | 
|---|
| 86 | pointer_default(unique) | 
|---|
| 87 | ] | 
|---|
| 88 | interface IXmlResolver : IUnknown | 
|---|
| 89 | { | 
|---|
| 90 | HRESULT ResolveUri([in] LPCWSTR base_uri, | 
|---|
| 91 | [in] LPCWSTR public_id, | 
|---|
| 92 | [in] LPCWSTR system_id, | 
|---|
| 93 | [out] IUnknown **input); | 
|---|
| 94 | } | 
|---|
| 95 |  | 
|---|
| 96 | /* IXmlReader state */ | 
|---|
| 97 | typedef enum XmlReadState | 
|---|
| 98 | { | 
|---|
| 99 | XmlReadState_Initial, | 
|---|
| 100 | XmlReadState_Interactive, | 
|---|
| 101 | XmlReadState_Error, | 
|---|
| 102 | XmlReadState_EndOfFile, | 
|---|
| 103 | XmlReadState_Closed | 
|---|
| 104 | } XmlReadState; | 
|---|
| 105 |  | 
|---|
| 106 | /* conformance levels */ | 
|---|
| 107 | typedef enum XmlConformanceLevel | 
|---|
| 108 | { | 
|---|
| 109 | XmlConformanceLevel_Auto, | 
|---|
| 110 | XmlConformanceLevel_Fragment, | 
|---|
| 111 | XmlConformanceLevel_Document, | 
|---|
| 112 | _XmlConformanceLevel_Last = XmlConformanceLevel_Document | 
|---|
| 113 | } XmlConformanceLevel; | 
|---|
| 114 |  | 
|---|
| 115 | /* DTD processing mode */ | 
|---|
| 116 | typedef enum DtdProcessing | 
|---|
| 117 | { | 
|---|
| 118 | DtdProcessing_Prohibit, | 
|---|
| 119 | DtdProcessing_Parse, | 
|---|
| 120 | _DtdProcessing_Last = DtdProcessing_Parse | 
|---|
| 121 | } DtdProcessing; | 
|---|
| 122 |  | 
|---|
| 123 | /* IXmlReader properties */ | 
|---|
| 124 | typedef enum XmlReaderProperty | 
|---|
| 125 | { | 
|---|
| 126 | XmlReaderProperty_MultiLanguage, | 
|---|
| 127 | XmlReaderProperty_ConformanceLevel, | 
|---|
| 128 | XmlReaderProperty_RandomAccess, | 
|---|
| 129 | XmlReaderProperty_XmlResolver, | 
|---|
| 130 | XmlReaderProperty_DtdProcessing, | 
|---|
| 131 | XmlReaderProperty_ReadState, | 
|---|
| 132 | XmlReaderProperty_MaxElementDepth, | 
|---|
| 133 | XmlReaderProperty_MaxEntityExpansion, | 
|---|
| 134 | _XmlReaderProperty_Last = XmlReaderProperty_MaxEntityExpansion | 
|---|
| 135 | } XmlReaderProperty; | 
|---|
| 136 |  | 
|---|
| 137 | /* reader error codes */ | 
|---|
| 138 | typedef enum XmlError | 
|---|
| 139 | { | 
|---|
| 140 | MX_E_MX = 0xc00cee00, | 
|---|
| 141 | MX_E_INPUTEND, | 
|---|
| 142 | MX_E_ENCODING, | 
|---|
| 143 | MX_E_ENCODINGSWITCH, | 
|---|
| 144 | MX_E_ENCODINGSIGNATURE, | 
|---|
| 145 | WC_E_WC = 0xc00cee20, | 
|---|
| 146 | WC_E_WHITESPACE, | 
|---|
| 147 | WC_E_SEMICOLON, | 
|---|
| 148 | WC_E_GREATERTHAN, | 
|---|
| 149 | WC_E_QUOTE, | 
|---|
| 150 | WC_E_EQUAL, | 
|---|
| 151 | WC_E_LESSTHAN, | 
|---|
| 152 | WC_E_HEXDIGIT, | 
|---|
| 153 | WC_E_DIGIT, | 
|---|
| 154 | WC_E_LEFTBRACKET, | 
|---|
| 155 | WC_E_LEFTPAREN, | 
|---|
| 156 | WC_E_XMLCHARACTER, | 
|---|
| 157 | WC_E_NAMECHARACTER, | 
|---|
| 158 | WC_E_SYNTAX, | 
|---|
| 159 | WC_E_CDSECT, | 
|---|
| 160 | WC_E_COMMENT, | 
|---|
| 161 | WC_E_CONDSECT, | 
|---|
| 162 | WC_E_DECLATTLIST, | 
|---|
| 163 | WC_E_DECLDOCTYPE, | 
|---|
| 164 | WC_E_DECLELEMENT, | 
|---|
| 165 | WC_E_DECLENTITY, | 
|---|
| 166 | WC_E_DECLNOTATION, | 
|---|
| 167 | WC_E_NDATA, | 
|---|
| 168 | WC_E_PUBLIC, | 
|---|
| 169 | WC_E_SYSTEM, | 
|---|
| 170 | WC_E_NAME, | 
|---|
| 171 | WC_E_ROOTELEMENT, | 
|---|
| 172 | WC_E_ELEMENTMATCH, | 
|---|
| 173 | WC_E_UNIQUEATTRIBUTE, | 
|---|
| 174 | WC_E_TEXTXMLDECL, | 
|---|
| 175 | WC_E_LEADINGXML, | 
|---|
| 176 | WC_E_TEXTDECL, | 
|---|
| 177 | WC_E_XMLDECL, | 
|---|
| 178 | WC_E_ENCNAME, | 
|---|
| 179 | WC_E_PUBLICID, | 
|---|
| 180 | WC_E_PESINTERNALSUBSET, | 
|---|
| 181 | WC_E_PESBETWEENDECLS, | 
|---|
| 182 | WC_E_NORECURSION, | 
|---|
| 183 | WC_E_ENTITYCONTENT, | 
|---|
| 184 | WC_E_UNDECLAREDENTITY, | 
|---|
| 185 | WC_E_PARSEDENTITY, | 
|---|
| 186 | WC_E_NOEXTERNALENTITYREF, | 
|---|
| 187 | WC_E_PI, | 
|---|
| 188 | WC_E_SYSTEMID, | 
|---|
| 189 | WC_E_QUESTIONMARK, | 
|---|
| 190 | WC_E_CDSECTEND, | 
|---|
| 191 | WC_E_MOREDATA, | 
|---|
| 192 | WC_E_DTDPROHIBITED, | 
|---|
| 193 | WC_E_INVALIDXMLSPACE, | 
|---|
| 194 | NC_E_NC = 0xc00cee60, | 
|---|
| 195 | NC_E_QNAMECHARACTER, | 
|---|
| 196 | NC_E_QNAMECOLON, | 
|---|
| 197 | NC_E_NAMECOLON, | 
|---|
| 198 | NC_E_DECLAREDPREFIX, | 
|---|
| 199 | NC_E_UNDECLAREDPREFIX, | 
|---|
| 200 | NC_E_EMPTYURI, | 
|---|
| 201 | NC_E_XMLPREFIXRESERVED, | 
|---|
| 202 | NC_E_XMLNSPREFIXRESERVED, | 
|---|
| 203 | NC_E_XMLURIRESERVED, | 
|---|
| 204 | NC_E_XMLNSURIRESERVED, | 
|---|
| 205 | SC_E_SC = 0xc00cee80, | 
|---|
| 206 | SC_E_MAXELEMENTDEPTH, | 
|---|
| 207 | SC_E_MAXENTITYEXPANSION, | 
|---|
| 208 | WR_E_WR = 0xc00cef00, | 
|---|
| 209 | WR_E_NONWHITESPACE, | 
|---|
| 210 | WR_E_NSPREFIXDECLARED, | 
|---|
| 211 | WR_E_NSPREFIXWITHEMPTYNSURI, | 
|---|
| 212 | WR_E_DUPLICATEATTRIBUTE, | 
|---|
| 213 | WR_E_XMLNSPREFIXDECLARATION, | 
|---|
| 214 | WR_E_XMLPREFIXDECLARATION, | 
|---|
| 215 | WR_E_XMLURIDECLARATION, | 
|---|
| 216 | WR_E_XMLNSURIDECLARATION, | 
|---|
| 217 | WR_E_NAMESPACEUNDECLARED, | 
|---|
| 218 | WR_E_INVALIDXMLSPACE, | 
|---|
| 219 | WR_E_INVALIDACTION, | 
|---|
| 220 | WR_E_INVALIDSURROGATEPAIR, | 
|---|
| 221 | XML_E_INVALID_DECIMAL = 0xc00ce01d, | 
|---|
| 222 | XML_E_INVALID_HEXIDECIMAL, | 
|---|
| 223 | XML_E_INVALID_UNICODE, | 
|---|
| 224 | XML_E_INVALIDENCODING = 0xc00ce06e | 
|---|
| 225 | } XmlError; | 
|---|
| 226 |  | 
|---|
| 227 | /* IXmlReader construction */ | 
|---|
| 228 | cpp_quote("STDAPI CreateXmlReader(REFIID riid, void **ppvObject, IMalloc *pMalloc);") | 
|---|
| 229 |  | 
|---|
| 230 | cpp_quote("typedef IUnknown IXmlReaderInput;") | 
|---|
| 231 | cpp_quote("STDAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream, IMalloc *pMalloc,") | 
|---|
| 232 | cpp_quote("                                            LPCWSTR encoding, WINBOOL hint,") | 
|---|
| 233 | cpp_quote("                                            LPCWSTR base_uri, IXmlReaderInput **ppInput);") | 
|---|
| 234 |  | 
|---|
| 235 | typedef enum XmlStandalone | 
|---|
| 236 | { | 
|---|
| 237 | XmlStandalone_Omit, | 
|---|
| 238 | XmlStandalone_Yes, | 
|---|
| 239 | XmlStandalone_No, | 
|---|
| 240 | _XmlStandalone_Last = XmlStandalone_No | 
|---|
| 241 | } XmlStandalone; | 
|---|
| 242 |  | 
|---|
| 243 | typedef enum XmlWriterProperty | 
|---|
| 244 | { | 
|---|
| 245 | XmlWriterProperty_MultiLanguage, | 
|---|
| 246 | XmlWriterProperty_Indent, | 
|---|
| 247 | XmlWriterProperty_ByteOrderMark, | 
|---|
| 248 | XmlWriterProperty_OmitXmlDeclaration, | 
|---|
| 249 | XmlWriterProperty_ConformanceLevel, | 
|---|
| 250 | _XmlWriterProperty_Last = XmlWriterProperty_OmitXmlDeclaration | 
|---|
| 251 | } XmlWriterProperty; | 
|---|
| 252 |  | 
|---|
| 253 | /* IXmlWriter */ | 
|---|
| 254 | [ | 
|---|
| 255 | local, | 
|---|
| 256 | object, | 
|---|
| 257 | uuid(7279FC88-709D-4095-B63D-69FE4B0D9030), | 
|---|
| 258 | pointer_default(unique) | 
|---|
| 259 | ] | 
|---|
| 260 | interface IXmlWriter : IUnknown | 
|---|
| 261 | { | 
|---|
| 262 | HRESULT SetOutput([in] IUnknown *pOutput); | 
|---|
| 263 | HRESULT GetProperty([in] UINT nProperty, [out] LONG_PTR *ppValue); | 
|---|
| 264 | HRESULT SetProperty([in] UINT nProperty, [in] LONG_PTR pValue); | 
|---|
| 265 | HRESULT WriteAttributes([in] IXmlReader *pReader, [in] BOOL fWriteDefaultAttributes); | 
|---|
| 266 | HRESULT WriteAttributeString([in] LPCWSTR pwszPrefix, [in] LPCWSTR pwszLocalName, | 
|---|
| 267 | [in] LPCWSTR pwszNamespaceUri, [in] LPCWSTR pwszValue); | 
|---|
| 268 | HRESULT WriteCData([in] LPCWSTR pwszText); | 
|---|
| 269 | HRESULT WriteCharEntity([in] WCHAR wch); | 
|---|
| 270 | HRESULT WriteChars([in] const WCHAR *pwch, [in] UINT cwch); | 
|---|
| 271 | HRESULT WriteComment([in] LPCWSTR pwszComment); | 
|---|
| 272 | HRESULT WriteDocType([in] LPCWSTR pwszName, [in] LPCWSTR pwszPublicId, | 
|---|
| 273 | [in] LPCWSTR pwszSystemId, [in] LPCWSTR pwszSubset); | 
|---|
| 274 | HRESULT WriteElementString([in] LPCWSTR pwszPrefix, [in] LPCWSTR pwszLocalName, | 
|---|
| 275 | [in] LPCWSTR pwszNamespaceUri, [in] LPCWSTR pwszValue); | 
|---|
| 276 | HRESULT WriteEndDocument(); | 
|---|
| 277 | HRESULT WriteEndElement(); | 
|---|
| 278 | HRESULT WriteEntityRef([in] LPCWSTR pwszName); | 
|---|
| 279 | HRESULT WriteFullEndElement(); | 
|---|
| 280 | HRESULT WriteName([in] LPCWSTR pwszName); | 
|---|
| 281 | HRESULT WriteNmToken([in] LPCWSTR pwszNmToken); | 
|---|
| 282 | HRESULT WriteNode([in] IXmlReader *pReader, [in] BOOL fWriteDefaultAttributes); | 
|---|
| 283 | HRESULT WriteNodeShallow([in] IXmlReader *pReader, [in] BOOL fWriteDefaultAttributes); | 
|---|
| 284 | HRESULT WriteProcessingInstruction([in] LPCWSTR pwszName, [in] LPCWSTR pwszText); | 
|---|
| 285 | HRESULT WriteQualifiedName([in] LPCWSTR pwszLocalName, [in] LPCWSTR pwszNamespaceUri); | 
|---|
| 286 | HRESULT WriteRaw([in] LPCWSTR pwszData); | 
|---|
| 287 | HRESULT WriteRawChars([in] const WCHAR *pwch, [in] UINT cwch); | 
|---|
| 288 | HRESULT WriteStartDocument([in] XmlStandalone standalone); | 
|---|
| 289 | HRESULT WriteStartElement([in] LPCWSTR pwszPrefix, [in] LPCWSTR pwszLocalName, | 
|---|
| 290 | [in]  LPCWSTR pwszNamespaceUri); | 
|---|
| 291 | HRESULT WriteString([in] LPCWSTR pwszText); | 
|---|
| 292 | HRESULT WriteSurrogateCharEntity([in] WCHAR wchLow, [in] WCHAR wchHigh); | 
|---|
| 293 | HRESULT WriteWhitespace([in] LPCWSTR pwszWhitespace); | 
|---|
| 294 | HRESULT Flush(); | 
|---|
| 295 | } | 
|---|
| 296 |  | 
|---|
| 297 | /* IXmlWriter construction */ | 
|---|
| 298 | cpp_quote("STDAPI CreateXmlWriter(REFIID riid, void **ppvObject, IMalloc *pMalloc);") | 
|---|
| 299 |  | 
|---|
| 300 | cpp_quote("typedef IUnknown IXmlWriterOutput;") | 
|---|
| 301 | cpp_quote("STDAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream, IMalloc *pMalloc,") | 
|---|
| 302 | cpp_quote("                                             LPCWSTR encoding, IXmlWriterOutput **output);") | 
|---|
| 303 | cpp_quote("STDAPI CreateXmlWriterOutputWithEncodingCodePage(IUnknown *stream, IMalloc *pMalloc,") | 
|---|
| 304 | cpp_quote("    UINT codepage, IXmlWriterOutput **output);") | 
|---|