1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <test/htmltesttools.hxx>
12 #include <boost/scoped_array.hpp>
14 htmlDocPtr
HtmlTestTools::parseHtml(utl::TempFile
& aTempFile
)
16 SvFileStream
aFileStream(aTempFile
.GetURL(), StreamMode::READ
);
17 htmlDocPtr doc
= parseHtmlStream(&aFileStream
);
19 doc
->name
= reinterpret_cast<char *>(
21 reinterpret_cast<xmlChar
const *>(
23 aTempFile
.GetURL(), RTL_TEXTENCODING_UTF8
).getStr())));
27 htmlDocPtr
HtmlTestTools::parseHtmlStream(SvStream
* pStream
)
29 sal_Size nSize
= pStream
->remainingSize();
30 boost::scoped_array
<sal_uInt8
> pBuffer(new sal_uInt8
[nSize
+ 1]);
31 pStream
->Read(pBuffer
.get(), nSize
);
33 return htmlParseDoc(reinterpret_cast<xmlChar
*>(pBuffer
.get()), NULL
);
36 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */