FastParser.cxx changes

If custom entity list is empty, custon entities by unicode value have to keep working.

Succefully loaded:
<?xml version="1.0" encoding="UTF-8"?>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
 <semantics>
  <mi>&#x3C3;</mi>
  <mi>&#x221E;</mi>
  <mi>&sigma;</mi>
  <mi>&infin;</mi>
 </semantics>
</math>

Change-Id: I46cc5b04bd91d1aaadf3f99cb2079325bb0d08cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107498
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
dante
2020-12-11 07:40:00 +01:00
committed by Mike Kaganski
parent 61d07657ca
commit b9ffc35911
3 changed files with 10 additions and 10 deletions
+9 -9
View File
@@ -933,7 +933,6 @@ void FastSaxParserImpl::setNamespaceHandler( const Reference< XFastNamespaceHand
maData.mxNamespaceHandler = Handler;
}
#include <stdio.h>
void FastSaxParserImpl::setCustomEntityNames( const ::css::uno::Sequence< ::rtl::OUString >& names, const ::css::uno::Sequence< ::rtl::OUString >& replacements )
{
mEntityNames = names;
@@ -1372,16 +1371,17 @@ xmlEntityPtr FastSaxParserImpl::callbackGetEntity( const xmlChar *name )
int lname = strlen(dname);
if( lname == 0 )
return xmlGetPredefinedEntity(name);
if( !mEntityNames.hasElements() )
return xmlGetPredefinedEntity(name);
for( size_t i = 0; i < mEntityNames.size(); ++i )
if (mEntityNames.hasElements())
{
if( mEntityNames[i].compareToAscii(dname) == 0 )
for (size_t i = 0; i < mEntityNames.size(); ++i)
{
return xmlNewEntity( nullptr,
name,
XML_INTERNAL_GENERAL_ENTITY, nullptr, nullptr,
BAD_CAST(OUStringToOString(mEntityReplacements[i],RTL_TEXTENCODING_UTF8).getStr()));
if (mEntityNames[i].compareToAscii(dname) == 0)
{
return xmlNewEntity(
nullptr, name, XML_INTERNAL_GENERAL_ENTITY, nullptr, nullptr,
BAD_CAST(
OUStringToOString(mEntityReplacements[i], RTL_TEXTENCODING_UTF8).getStr()));
}
}
}
if( lname < 2 )
-1
View File
@@ -13,7 +13,6 @@
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <tools/fract.hxx>
#include "xparsmlbase.hxx"
// MathML 3: 2.1.5.1 Syntax notation used in the MathML specification
// <https://www.w3.org/TR/MathML/chapter2.html#id.2.1.5.1>
+1
View File
@@ -63,6 +63,7 @@ one go*/
#include <memory>
#include "mathmlattr.hxx"
#include "xparsmlbase.hxx"
#include "mathmlimport.hxx"
#include <document.hxx>
#include <smdll.hxx>