/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
/** * The return value and the referenced value must be NULL terminated. * The application has the responsibility to deallocate the return value.
*/ staticconst xmlChar** attrlist_to_nxmlstr( const css::uno::Sequence< css::xml::csax::XMLAttribute >& aAttributes )
{
xmlChar* attname = nullptr ;
xmlChar* attvalue = nullptr ; const xmlChar** attrs = nullptr ;
if( m_pParserCtxt == nullptr )
{ // see issue i74334, we cannot call xmlCleanupParser when libxml is still used // in other parts of the office. // xmlCleanupParser() ; // and neither can we call xsltCleanupGlobals() throw css::uno::RuntimeException() ;
}
xmlSAXVersion(m_pParserCtxt->sax, 1);
if (m_pParserCtxt->inputTab != nullptr)
{
m_pParserCtxt->inputTab[0] = nullptr ;
}
// see issue i74334, we cannot call xmlCleanupParser when libxml is still used // in other parts of the office. // xmlCleanupParser() ; // and neither can we call xsltCleanupGlobals()
m_pParserCtxt = nullptr ; throw css::uno::RuntimeException() ;
} else
{
m_pSaxHandler = m_pParserCtxt->sax ;
//Adjust the context
m_pParserCtxt->recovery = 1 ;
}
}
/** * Destructor * * In this destructor, a libxml sax parser context is destructed. The XML tree * in the context is not deallocated because the tree is bind with a document * model by the setTargetDocument method, which delegate the target document to * destruct the xml tree.
*/
SAXHelper::~SAXHelper() { if( m_pParserCtxt != nullptr )
{ /* * In the situation that no object refer the Document, this destructor * must deallocate the Document memory
*/ if( m_pSaxHandler == m_pParserCtxt->sax )
{
m_pSaxHandler = nullptr ;
}
if( m_pSaxHandler != nullptr )
{
xmlFree( m_pSaxHandler ) ;
m_pSaxHandler = nullptr ;
} // see issue i74334, we cannot call xmlCleanupParser when libxml is still used // in other parts of the office. // xmlCleanupParser() ;
}
void SAXHelper::setCurrentNode(const xmlNodePtr pNode)
{ /* * This is really a black trick. * When the current node is replaced, the nodeTab * stack's top has to been replaced with the same * node, in order to make compatibility.
*/
m_pParserCtxt->nodeTab[m_pParserCtxt->nodeNr - 1]
= m_pParserCtxt->node
= pNode;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.