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 #ifndef INCLUDED_TOOLS_XMLWRITER_HXX
11 #define INCLUDED_TOOLS_XMLWRITER_HXX
13 #include <tools/toolsdllapi.h>
14 #include <rtl/ustring.hxx>
25 * XmlWriter writes a XML to a SvStream. It uses libxml2 for writing but hides
26 * all the internal libxml2 workings and uses types that are native for LO
29 * The codepage used for XML is always "utf-8" and the output is indented by
30 * default so it is easier to read.
33 class TOOLS_DLLPUBLIC XmlWriter final
36 std::unique_ptr
<XmlWriterImpl
> mpImpl
;
39 XmlWriter(SvStream
* pStream
);
43 bool startDocument(sal_Int32 nIndent
= 2, bool bWriteXmlHeader
= true);
46 void startElement(const OString
& sName
);
47 void startElement(const OString
& sPrefix
, const OString
& sName
, const OString
& sNamespaceUri
);
50 void attribute(const OString
& sTagName
, const OString
& aValue
);
51 void attribute(const OString
& sTagName
, const OUString
& aValue
);
52 void attribute(const OString
& sTagName
, sal_Int32 aNumber
);
53 void attributeDouble(const OString
& sTagName
, double aNumber
);
54 void attributeBase64(const OString
& sTagName
, std::vector
<sal_uInt8
> const& rValueInBytes
);
55 void attributeBase64(const OString
& sTagName
, std::vector
<char> const& rValueInBytes
);
57 void content(const OString
& sValue
);
58 void content(const OUString
& sValue
);
60 void element(const OString
& sName
);
63 } // end tools namespace
65 #endif // INCLUDED_TOOLS_XMLWRITER_HXX
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */