LibreOffice Module xmloff (master)  1
DomBuilderContext.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 <xmloff/xmlictxt.hxx>
23 
24 
25 // forward declarations
26 
27 
28 namespace com::sun::star {
29  namespace xml::dom {
30  class XNode;
31  class XDocument;
32  }
33  namespace xml::sax {
34  class XAttributeList;
35  }
36 }
37 class SvXMLImport;
38 class SvXMLImportContext;
39 
44 {
45  css::uno::Reference<css::xml::dom::XNode> mxNode;
46 
47  void HandleAttributes(const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs);
48 
49 public:
50 
53  sal_Int32 nElement );
55  const OUString & Namespace, const OUString & Name );
56 
59  sal_Int32 nElement,
60  css::uno::Reference<css::xml::dom::XNode> const & );
63  const OUString & Namespace, const OUString & Name,
64  css::uno::Reference<css::xml::dom::XNode> const & );
65 
66  virtual ~DomBuilderContext() override;
67 
68 
69  // access to the DOM tree
70 
71 
73  css::uno::Reference<css::xml::dom::XDocument> getTree();
74 
75 
76  // implement SvXMLImportContext methods:
77 
78  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
79  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
80  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext(
81  const OUString& Namespace, const OUString& Name,
82  const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
83 
84  virtual void SAL_CALL startFastElement(
85  sal_Int32 nElement,
86  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
87  virtual void SAL_CALL startUnknownElement(const OUString & Namespace, const OUString & Name,
88  const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
89 
90  virtual void SAL_CALL characters( const OUString& rChars ) override;
91 };
92 
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void HandleAttributes(const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs)
DomBuilderContext creates a DOM tree suitable for in-memory processing of XML data from a sequence of...
DomBuilderContext(SvXMLImport &rImport, sal_Int32 nElement)
default constructor: create new DOM tree
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext(const OUString &Namespace, const OUString &Name, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
virtual ~DomBuilderContext() override
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
virtual void SAL_CALL startUnknownElement(const OUString &Namespace, const OUString &Name, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
css::uno::Reference< css::xml::dom::XDocument > getTree()
access the DOM tree
css::uno::Reference< css::xml::dom::XNode > mxNode
virtual void SAL_CALL characters(const OUString &rChars) override
This method is called for all characters that are contained in the current element.