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 54 void endDocument( void ) ; 55 56 void startElement( 57 const ::rtl::OUString& aName , 58 const com::sun::star::uno::Sequence< 59 com::sun::star::xml::csax::XMLAttribute >& aAttributes ) ; 60 61 void endElement( const ::rtl::OUString& aName ) ; 62 63 void characters( const ::rtl::OUString& aChars ) ; 64 65 void ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) ; 66 67 void processingInstruction( 68 const ::rtl::OUString& aTarget , 69 const ::rtl::OUString& aData ) ; 70 71 void setDocumentLocator( const ::com::sun::star::uno::Reference< 72 ::com::sun::star::xml::sax::XLocator > & xLocator ) ; 73 } ; 74 75 #endif 76