1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _XMLOFF_DOMBUILDERCONTEXT_HXX
25 #define _XMLOFF_DOMBUILDERCONTEXT_HXX
26 
27 
28 //
29 // include for parent class and members
30 //
31 
32 #include <xmloff/xmlictxt.hxx>
33 
34 
35 //
36 // forward declarations
37 //
38 
39 namespace com { namespace sun { namespace star {
40     namespace xml { namespace dom {
41         class XNode;
42         class XDocument;
43     } }
44     namespace xml { namespace sax {
45         class XAttributeList;
46     } }
47 } } }
48 namespace rtl {
49     class OUString;
50 }
51 class SvXMLImport;
52 class SvXMLImportContext;
53 
54 /**
55  * DomBuilderContext creates a DOM tree suitable for in-memory processing of
56  * XML data from a sequence of SAX events */
57 class DomBuilderContext : public SvXMLImportContext
58 {
59     com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode> mxNode;
60 
61 public:
62 
63     /** default constructor: create new DOM tree */
64     DomBuilderContext( SvXMLImport& rImport,
65                        sal_uInt16 nPrefix,
66                        const ::rtl::OUString& rLocalName );
67 
68     /** constructor: create DOM subtree under the given node */
69     DomBuilderContext( SvXMLImport& rImport,
70                        sal_uInt16 nPrefix,
71                        const ::rtl::OUString& rLocalName,
72                        com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode>& );
73 
74     virtual ~DomBuilderContext();
75 
76 
77     //
78     // access to the DOM tree
79     //
80 
81     /** access the DOM tree */
82     com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument> getTree();
83 
84     /** access this context's DOM sub-tree */
85     com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode> getNode();
86 
87 
88     //
89     // implement SvXMLImportContext methods:
90     //
91 
92 	virtual SvXMLImportContext* CreateChildContext(
93         sal_uInt16 nPrefix,
94         const rtl::OUString& rLocalName,
95         const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList >& xAttrList );
96 
97 	virtual void StartElement(
98         const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
99 
100 	virtual void EndElement();
101 
102 	virtual void Characters( const ::rtl::OUString& rChars );
103 };
104 
105 #endif
106