LibreOffice Module xmlsecurity (master) 1
saxhelper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <string_view>
25
26#include <libxml/tree.h>
27
28#include <rtl/ustring.hxx>
29
30namespace com::sun::star::xml::csax { struct XMLAttribute; }
31namespace com::sun::star::uno { template <typename > class Sequence; }
32
36class SAXHelper final
37{
38 private:
39 xmlParserCtxtPtr m_pParserCtxt ;
40 xmlSAXHandlerPtr m_pSaxHandler ;
41
42 public:
43 SAXHelper( ) ;
44 ~SAXHelper() ;
45
46 xmlNodePtr getCurrentNode() { return m_pParserCtxt->node;}
47 void setCurrentNode(const xmlNodePtr pNode);
48 xmlDocPtr getDocument() { return m_pParserCtxt->myDoc;}
49
52 void startDocument() ;
53
56 void endDocument() ;
57
60 void startElement(
61 std::u16string_view aName ,
62 const css::uno::Sequence<
63 css::xml::csax::XMLAttribute >& aAttributes ) ;
64
67 void endElement( std::u16string_view aName ) ;
68
71 void characters( std::u16string_view aChars ) ;
72
75 void ignorableWhitespace( std::u16string_view aWhitespaces ) ;
76
80 std::u16string_view aTarget ,
81 std::u16string_view aData ) ;
82
83} ;
84
85/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class represents a SAX handler which simply forwards to the corresponding libxml API and transla...
Definition: saxhelper.hxx:37
xmlSAXHandlerPtr m_pSaxHandler
Definition: saxhelper.hxx:40
xmlDocPtr getDocument()
Definition: saxhelper.hxx:48
~SAXHelper()
Destructor.
Definition: saxhelper.cxx:173
xmlParserCtxtPtr m_pParserCtxt
Definition: saxhelper.hxx:39
void characters(std::u16string_view aChars)
XDocumentHandler – an xml element or cdata characters.
Definition: saxhelper.cxx:305
void endElement(std::u16string_view aName)
XDocumentHandler – end an xml element.
Definition: saxhelper.cxx:290
void setCurrentNode(const xmlNodePtr pNode)
Definition: saxhelper.cxx:200
void startElement(std::u16string_view aName, const css::uno::Sequence< css::xml::csax::XMLAttribute > &aAttributes)
XDocumentHandler – start an xml element.
Definition: saxhelper.cxx:253
void ignorableWhitespace(std::u16string_view aWhitespaces)
XDocumentHandler – ignorable xml white space.
Definition: saxhelper.cxx:322
void startDocument()
XDocumentHandler – start an xml document.
Definition: saxhelper.cxx:217
void endDocument()
XDocumentHandler – end an xml document.
Definition: saxhelper.cxx:245
xmlNodePtr getCurrentNode()
Definition: saxhelper.hxx:46
void processingInstruction(std::u16string_view aTarget, std::u16string_view aData)
XDocumentHandler – preprocessing instruction.
Definition: saxhelper.cxx:339
SAXHelper()
Constructor.
Definition: saxhelper.cxx:110