1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _XMLOFF_DOMBUILDERCONTEXT_HXX 29 #define _XMLOFF_DOMBUILDERCONTEXT_HXX 30 31 32 // 33 // include for parent class and members 34 // 35 36 #include <xmloff/xmlictxt.hxx> 37 38 39 // 40 // forward declarations 41 // 42 43 namespace com { namespace sun { namespace star { 44 namespace xml { namespace dom { 45 class XNode; 46 class XDocument; 47 } } 48 namespace xml { namespace sax { 49 class XAttributeList; 50 } } 51 } } } 52 namespace rtl { 53 class OUString; 54 } 55 class SvXMLImport; 56 class SvXMLImportContext; 57 58 /** 59 * DomBuilderContext creates a DOM tree suitable for in-memory processing of 60 * XML data from a sequence of SAX events */ 61 class DomBuilderContext : public SvXMLImportContext 62 { 63 com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode> mxNode; 64 65 public: 66 67 /** default constructor: create new DOM tree */ 68 DomBuilderContext( SvXMLImport& rImport, 69 sal_uInt16 nPrefix, 70 const ::rtl::OUString& rLocalName ); 71 72 /** constructor: create DOM subtree under the given node */ 73 DomBuilderContext( SvXMLImport& rImport, 74 sal_uInt16 nPrefix, 75 const ::rtl::OUString& rLocalName, 76 com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode>& ); 77 78 virtual ~DomBuilderContext(); 79 80 81 // 82 // access to the DOM tree 83 // 84 85 /** access the DOM tree */ 86 com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument> getTree(); 87 88 /** access this context's DOM sub-tree */ 89 com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode> getNode(); 90 91 92 // 93 // implement SvXMLImportContext methods: 94 // 95 96 virtual SvXMLImportContext* CreateChildContext( 97 sal_uInt16 nPrefix, 98 const rtl::OUString& rLocalName, 99 const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList >& xAttrList ); 100 101 virtual void StartElement( 102 const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList ); 103 104 virtual void EndElement(); 105 106 virtual void Characters( const ::rtl::OUString& rChars ); 107 }; 108 109 #endif 110