4 * Copyright 2008 Piotr Caban
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wine/test.h"
32 typedef struct _contenthandler
34 const struct ISAXContentHandlerVtbl
*lpContentHandlerVtbl
;
37 static inline contenthandler
*impl_from_ISAXContentHandler(ISAXContentHandler
*iface
)
39 return (contenthandler
*)((char*)iface
- FIELD_OFFSET(contenthandler
, lpContentHandlerVtbl
));
42 static HRESULT WINAPI
contentHandler_QueryInterface(
43 ISAXContentHandler
* iface
,
49 if(IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_ISAXContentHandler
))
61 static ULONG WINAPI
contentHandler_AddRef(
62 ISAXContentHandler
* iface
)
67 static ULONG WINAPI
contentHandler_Release(
68 ISAXContentHandler
* iface
)
73 static HRESULT WINAPI
contentHandler_putDocumentLocator(
74 ISAXContentHandler
* iface
,
75 ISAXLocator
*pLocator
)
80 static HRESULT WINAPI
contentHandler_startDocument(
81 ISAXContentHandler
* iface
)
86 static HRESULT WINAPI
contentHandler_endDocument(
87 ISAXContentHandler
* iface
)
92 static HRESULT WINAPI
contentHandler_startPrefixMapping(
93 ISAXContentHandler
* iface
,
102 static HRESULT WINAPI
contentHandler_endPrefixMapping(
103 ISAXContentHandler
* iface
,
104 const WCHAR
*pPrefix
,
110 static HRESULT WINAPI
contentHandler_startElement(
111 ISAXContentHandler
* iface
,
112 const WCHAR
*pNamespaceUri
,
114 const WCHAR
*pLocalName
,
118 ISAXAttributes
*pAttr
)
123 static HRESULT WINAPI
contentHandler_endElement(
124 ISAXContentHandler
* iface
,
125 const WCHAR
*pNamespaceUri
,
127 const WCHAR
*pLocalName
,
135 static HRESULT WINAPI
contentHandler_characters(
136 ISAXContentHandler
* iface
,
143 static HRESULT WINAPI
contentHandler_ignorableWhitespace(
144 ISAXContentHandler
* iface
,
151 static HRESULT WINAPI
contentHandler_processingInstruction(
152 ISAXContentHandler
* iface
,
153 const WCHAR
*pTarget
,
161 static HRESULT WINAPI
contentHandler_skippedEntity(
162 ISAXContentHandler
* iface
,
170 static const ISAXContentHandlerVtbl contentHandlerVtbl
=
172 contentHandler_QueryInterface
,
173 contentHandler_AddRef
,
174 contentHandler_Release
,
175 contentHandler_putDocumentLocator
,
176 contentHandler_startDocument
,
177 contentHandler_endDocument
,
178 contentHandler_startPrefixMapping
,
179 contentHandler_endPrefixMapping
,
180 contentHandler_startElement
,
181 contentHandler_endElement
,
182 contentHandler_characters
,
183 contentHandler_ignorableWhitespace
,
184 contentHandler_processingInstruction
,
185 contentHandler_skippedEntity
188 static ISAXContentHandler contentHandler
= { &contentHandlerVtbl
};
191 static void test_saxreader(void)
194 ISAXXMLReader
*reader
= NULL
;
196 hr
= CoCreateInstance(&CLSID_SAXXMLReader
, NULL
, CLSCTX_INPROC_SERVER
,
197 &IID_ISAXXMLReader
, (LPVOID
*)&reader
);
201 skip("Failed to create SAXXMLReader instance\n");
205 hr
= ISAXXMLReader_putContentHandler(reader
, &contentHandler
);
206 ok(hr
== S_OK
, "Expected S_OK, got %08x\n", hr
);
208 ISAXXMLReader_Release(reader
);
211 START_TEST(saxreader
)
215 hr
= CoInitialize(NULL
);
216 ok(hr
== S_OK
, "failed to init com\n");