xref: /AOO41X/main/xmlsecurity/source/xmlsec/saxhelper.hxx (revision ec61c6ed669d81c7df08233ccc38d0040f129ece)
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 _SAXHELPER_HXX
25 #define _SAXHELPER_HXX
26 
27 #include "libxml/tree.h"
28 
29 #include <com/sun/star/xml/sax/SAXException.hpp>
30 #include <com/sun/star/xml/sax/XAttributeList.hpp>
31 #include <com/sun/star/xml/sax/XLocator.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/xml/csax/XMLAttribute.hpp>
34 
35 /** This class represents a SAX handler which simply forwards to
36     the corresponding libxml API and translates parameter if necessary.
37 */
38 class SAXHelper
39 {
40     private :
41         xmlParserCtxtPtr m_pParserCtxt ;
42         xmlSAXHandlerPtr m_pSaxHandler ;
43 
44     public:
45         SAXHelper( ) ;
46         virtual ~SAXHelper() ;
47 
48         xmlNodePtr getCurrentNode();
49         void setCurrentNode(const xmlNodePtr pNode);
50         xmlDocPtr getDocument();
51 
52         void startDocument( void )
53             throw( ::com::sun::star::xml::sax::SAXException , ::com::sun::star::uno::RuntimeException ) ;
54 
55         void endDocument( void )
56             throw( ::com::sun::star::xml::sax::SAXException , ::com::sun::star::uno::RuntimeException ) ;
57 
58         void startElement(
59             const ::rtl::OUString& aName ,
60             const com::sun::star::uno::Sequence<
61                 com::sun::star::xml::csax::XMLAttribute >& aAttributes )
62             throw( ::com::sun::star::xml::sax::SAXException , ::com::sun::star::uno::RuntimeException ) ;
63 
64         void endElement( const ::rtl::OUString& aName )
65             throw( ::com::sun::star::xml::sax::SAXException , ::com::sun::star::uno::RuntimeException ) ;
66 
67         void characters( const ::rtl::OUString& aChars )
68             throw( ::com::sun::star::xml::sax::SAXException , ::com::sun::star::uno::RuntimeException ) ;
69 
70         void ignorableWhitespace( const ::rtl::OUString& aWhitespaces )
71             throw( ::com::sun::star::xml::sax::SAXException , ::com::sun::star::uno::RuntimeException ) ;
72 
73         void processingInstruction(
74             const ::rtl::OUString& aTarget ,
75             const ::rtl::OUString& aData )
76             throw( ::com::sun::star::xml::sax::SAXException , ::com::sun::star::uno::RuntimeException ) ;
77 
78         void setDocumentLocator( const ::com::sun::star::uno::Reference<
79             ::com::sun::star::xml::sax::XLocator > & xLocator )
80             throw( ::com::sun::star::xml::sax::SAXException , ::com::sun::star::uno::RuntimeException ) ;
81 } ;
82 
83 #endif
84 
85