[Libreoffice-commits] core.git: sc/source

Mohammed Abdul Azeem azeemmysore at gmail.com
Mon Jul 24 10:06:49 UTC 2017


 sc/source/filter/xml/xmldrani.cxx |  480 +++++++++++++++-----------------------
 sc/source/filter/xml/xmldrani.hxx |  101 +++----
 sc/source/filter/xml/xmlfilti.cxx |   74 ++---
 sc/source/filter/xml/xmlfilti.hxx |    7 
 sc/source/filter/xml/xmlnexpi.cxx |  152 ++++--------
 sc/source/filter/xml/xmlnexpi.hxx |   27 --
 sc/source/filter/xml/xmlsorti.cxx |  100 ++++---
 sc/source/filter/xml/xmlsorti.hxx |    7 
 8 files changed, 398 insertions(+), 550 deletions(-)

New commits:
commit 316ea4a15826df71fad9fe0fe80c9feb49511f13
Author: Mohammed Abdul Azeem <azeemmysore at gmail.com>
Date:   Sun Jul 23 11:52:59 2017 +0530

    Moving legacy contexts to FastContexts:
    
    ScXMLSourceSQLContext
    ScXMLSourceTableContext
    ScXMLSourceQueryContext
    ScXMLConResContext
    ScXMLSubTotalRulesContext
    ScXMLSortGroupsContext
    ScXMLSubTotalRuleContext
    ScXMLSubTotalFieldContext
    ScXMLFilterContext
    ScXMLNamedRangeContext
    ScXMLNamedExpressionContext
    ScXMLSortContext
    
    Change-Id: I060e92dc9745b62842d1fc09851aba22c3a8a366
    Reviewed-on: https://gerrit.libreoffice.org/40320
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx
index fd9e6f6d74f6..22860afdf71d 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -204,57 +204,50 @@ ScXMLDatabaseRangeContext::~ScXMLDatabaseRangeContext()
 {
 }
 
-SvXMLImportContext *ScXMLDatabaseRangeContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDatabaseRangeContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext = nullptr;
 
-    const SvXMLTokenMap& rTokenMap = GetScImport().GetDatabaseRangeElemTokenMap();
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_DATABASE_RANGE_SOURCE_SQL :
+        case XML_ELEMENT( TABLE, XML_DATABASE_SOURCE_SQL ):
         {
-            pContext = new ScXMLSourceSQLContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, this);
+            pContext = new ScXMLSourceSQLContext( GetScImport(), nElement, xAttrList, this);
         }
         break;
-        case XML_TOK_DATABASE_RANGE_SOURCE_TABLE :
+        case XML_ELEMENT( TABLE, XML_DATABASE_SOURCE_TABLE ):
         {
-            pContext = new ScXMLSourceTableContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, this);
+            pContext = new ScXMLSourceTableContext( GetScImport(), nElement, xAttrList, this);
         }
         break;
-        case XML_TOK_DATABASE_RANGE_SOURCE_QUERY :
+        case XML_ELEMENT( TABLE, XML_DATABASE_SOURCE_QUERY ):
         {
-            pContext = new ScXMLSourceQueryContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, this);
+            pContext = new ScXMLSourceQueryContext( GetScImport(), nElement, xAttrList, this);
         }
         break;
-        case XML_TOK_FILTER :
+        case XML_ELEMENT( TABLE, XML_FILTER ):
         {
             pContext = new ScXMLFilterContext(
-                GetScImport(), nPrefix, rLName, xAttrList, *mpQueryParam, this);
+                GetScImport(), nElement, xAttrList, *mpQueryParam, this);
         }
         break;
-        case XML_TOK_SORT :
+        case XML_ELEMENT( TABLE, XML_SORT ):
         {
             bContainsSort = true;
-            pContext = new ScXMLSortContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, this);
+            pContext = new ScXMLSortContext( GetScImport(), nElement, xAttrList, this);
         }
         break;
-        case XML_TOK_DATABASE_RANGE_SUBTOTAL_RULES :
+        case XML_ELEMENT( TABLE, XML_SUBTOTAL_RULES ):
         {
             bContainsSubTotal = true;
-            pContext = new ScXMLSubTotalRulesContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, this);
+            pContext = new ScXMLSubTotalRulesContext( GetScImport(), nElement, xAttrList, this);
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
@@ -462,40 +455,31 @@ void SAL_CALL ScXMLDatabaseRangeContext::endFastElement( sal_Int32 /*nElement*/
 }
 
 ScXMLSourceSQLContext::ScXMLSourceSQLContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pDatabaseRangeContext(pTempDatabaseRangeContext)
 {
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDatabaseRangeSourceSQLAttrTokenMap();
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName );
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_SOURCE_SQL_ATTR_DATABASE_NAME :
+            switch (aIter.getToken())
             {
-                sDBName = sValue;
+                case XML_ELEMENT( TABLE, XML_DATABASE_NAME ):
+                    sDBName = aIter.toString();
+                    break;
+                case XML_ELEMENT( TABLE, XML_SQL_STATEMENT ):
+                    pDatabaseRangeContext->SetSourceObject(aIter.toString());
+                    break;
+                case XML_ELEMENT( TABLE, XML_PARSE_SQL_STATEMENT ):
+                    pDatabaseRangeContext->SetNative(IsXMLToken(aIter, XML_TRUE));
+                    break;
             }
-            break;
-            case XML_TOK_SOURCE_SQL_ATTR_SQL_STATEMENT :
-            {
-                pDatabaseRangeContext->SetSourceObject(sValue);
-            }
-            break;
-            case XML_TOK_SOURCE_SQL_ATTR_PARSE_SQL_STATEMENT :
-            {
-                pDatabaseRangeContext->SetNative(IsXMLToken(sValue, XML_TRUE));
-            }
-            break;
         }
     }
     pDatabaseRangeContext->SetSourceType(sheet::DataImportMode_SQL);
@@ -505,63 +489,52 @@ ScXMLSourceSQLContext::~ScXMLSourceSQLContext()
 {
 }
 
-SvXMLImportContext *ScXMLSourceSQLContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceSQLContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext = nullptr;
 
-    if ( nPrefix == XML_NAMESPACE_FORM )
+    if ( nElement == XML_ELEMENT( FORM, XML_CONNECTION_RESOURCE ) && sDBName.isEmpty() )
     {
-        if (IsXMLToken(rLName, XML_CONNECTION_RESOURCE) && sDBName.isEmpty())
-        {
-            pContext = new ScXMLConResContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, pDatabaseRangeContext);
-        }
+        pContext = new ScXMLConResContext( GetScImport(), nElement, xAttrList, pDatabaseRangeContext);
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
 
-void ScXMLSourceSQLContext::EndElement()
+void SAL_CALL ScXMLSourceSQLContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     if (!sDBName.isEmpty())
         pDatabaseRangeContext->SetDatabaseName(sDBName);
 }
 
 ScXMLSourceTableContext::ScXMLSourceTableContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pDatabaseRangeContext(pTempDatabaseRangeContext)
 {
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDatabaseRangeSourceTableAttrTokenMap();
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName );
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_SOURCE_TABLE_ATTR_DATABASE_NAME :
-            {
-                sDBName = sValue;
-            }
-            break;
-            case XML_TOK_SOURCE_TABLE_ATTR_TABLE_NAME :
+            switch (aIter.getToken())
             {
-                pDatabaseRangeContext->SetSourceObject(sValue);
+                case XML_ELEMENT( TABLE, XML_DATABASE_NAME ):
+                    sDBName = aIter.toString();
+                    break;
+                case XML_ELEMENT( TABLE, XML_TABLE_NAME ):
+                case XML_ELEMENT( TABLE, XML_DATABASE_TABLE_NAME ):
+                    pDatabaseRangeContext->SetSourceObject(aIter.toString());
+                    break;
             }
-            break;
         }
     }
     pDatabaseRangeContext->SetSourceType(sheet::DataImportMode_TABLE);
@@ -571,63 +544,51 @@ ScXMLSourceTableContext::~ScXMLSourceTableContext()
 {
 }
 
-SvXMLImportContext *ScXMLSourceTableContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceTableContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext = nullptr;
 
-    if ( nPrefix == XML_NAMESPACE_FORM )
+    if ( nElement == XML_ELEMENT( FORM, XML_CONNECTION_RESOURCE ) && sDBName.isEmpty() )
     {
-        if (IsXMLToken(rLName, XML_CONNECTION_RESOURCE) && sDBName.isEmpty())
-        {
-            pContext = new ScXMLConResContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, pDatabaseRangeContext);
-        }
+        pContext = new ScXMLConResContext( GetScImport(), nElement, xAttrList, pDatabaseRangeContext);
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
 
-void ScXMLSourceTableContext::EndElement()
+void SAL_CALL ScXMLSourceTableContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     if (!sDBName.isEmpty())
         pDatabaseRangeContext->SetDatabaseName(sDBName);
 }
 
 ScXMLSourceQueryContext::ScXMLSourceQueryContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pDatabaseRangeContext(pTempDatabaseRangeContext)
 {
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDatabaseRangeSourceQueryAttrTokenMap();
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName );
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_SOURCE_QUERY_ATTR_DATABASE_NAME :
-            {
-                sDBName = sValue;
-            }
-            break;
-            case XML_TOK_SOURCE_QUERY_ATTR_QUERY_NAME :
+            switch (aIter.getToken())
             {
-                pDatabaseRangeContext->SetSourceObject(sValue);
+                case XML_ELEMENT( TABLE, XML_DATABASE_NAME ):
+                    sDBName = aIter.toString();
+                    break;
+                case XML_ELEMENT( TABLE, XML_QUERY_NAME ):
+                    pDatabaseRangeContext->SetSourceObject(aIter.toString());
+                    break;
             }
-            break;
         }
     }
     pDatabaseRangeContext->SetSourceType(sheet::DataImportMode_QUERY);
@@ -637,56 +598,44 @@ ScXMLSourceQueryContext::~ScXMLSourceQueryContext()
 {
 }
 
-SvXMLImportContext *ScXMLSourceQueryContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceQueryContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext = nullptr;
 
-    if ( nPrefix == XML_NAMESPACE_FORM )
+    if ( nElement == XML_ELEMENT( FORM, XML_CONNECTION_RESOURCE ) && sDBName.isEmpty() )
     {
-        if (IsXMLToken(rLName, XML_CONNECTION_RESOURCE) && sDBName.isEmpty())
-        {
-            pContext = new ScXMLConResContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, pDatabaseRangeContext);
-        }
+        pContext = new ScXMLConResContext( GetScImport(), nElement, xAttrList, pDatabaseRangeContext);
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
 
-void ScXMLSourceQueryContext::EndElement()
+void SAL_CALL ScXMLSourceQueryContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     if (!sDBName.isEmpty())
         pDatabaseRangeContext->SetDatabaseName(sDBName);
 }
 
 ScXMLConResContext::ScXMLConResContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pDatabaseRangeContext( pTempDatabaseRangeContext )
 {
     OUString sConRes;
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    for( sal_Int16 i=0; i < nAttrCount; i++ )
+    if ( xAttrList.is() )
     {
-        OUString sAttrName = xAttrList->getNameByIndex( i );
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName );
-        OUString sValue = xAttrList->getValueByIndex( i );
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        if (nPrefix == XML_NAMESPACE_XLINK)
-        {
-            if (IsXMLToken(aLocalName, XML_HREF))
-                sConRes = sValue;
-        }
+        auto &aIter( pAttribList->find( XML_ELEMENT( XLINK, XML_HREF ) ) );
+        if (aIter != pAttribList->end())
+            sConRes = aIter.toString();
     }
     if (!sConRes.isEmpty())
         pDatabaseRangeContext->SetConnectionResource(sConRes);
@@ -696,52 +645,38 @@ ScXMLConResContext::~ScXMLConResContext()
 {
 }
 
-SvXMLImportContext *ScXMLConResContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
-{
-    return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
-void ScXMLConResContext::EndElement()
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLConResContext::createFastChildContext(
+    sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
 {
+    return new SvXMLImportContext( GetImport() );
 }
 
 ScXMLSubTotalRulesContext::ScXMLSubTotalRulesContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pDatabaseRangeContext(pTempDatabaseRangeContext)
 {
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDatabaseRangeSubTotalRulesAttrTokenMap();
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName );
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_SUBTOTAL_RULES_ATTR_BIND_STYLES_TO_CONTENT :
+            switch (aIter.getToken())
             {
-                pDatabaseRangeContext->SetSubTotalsBindFormatsToContent(IsXMLToken(sValue, XML_TRUE));
+                case XML_ELEMENT( TABLE, XML_BIND_STYLES_TO_CONTENT ):
+                    pDatabaseRangeContext->SetSubTotalsBindFormatsToContent(IsXMLToken(aIter, XML_TRUE));
+                    break;
+                case XML_ELEMENT( TABLE, XML_CASE_SENSITIVE ):
+                    pDatabaseRangeContext->SetSubTotalsIsCaseSensitive(IsXMLToken(aIter, XML_TRUE));
+                    break;
+                case XML_ELEMENT( TABLE, XML_PAGE_BREAKS_ON_GROUP_CHANGE ):
+                    pDatabaseRangeContext->SetSubTotalsInsertPageBreaks(IsXMLToken(aIter, XML_TRUE));
+                    break;
             }
-            break;
-            case XML_TOK_SUBTOTAL_RULES_ATTR_CASE_SENSITIVE :
-            {
-                pDatabaseRangeContext->SetSubTotalsIsCaseSensitive(IsXMLToken(sValue, XML_TRUE));
-            }
-            break;
-            case XML_TOK_SUBTOTAL_RULES_ATTR_PAGE_BREAKS_ON_GROUP_CHANGE :
-            {
-                pDatabaseRangeContext->SetSubTotalsInsertPageBreaks(IsXMLToken(sValue, XML_TRUE));
-            }
-            break;
         }
     }
 }
@@ -750,97 +685,87 @@ ScXMLSubTotalRulesContext::~ScXMLSubTotalRulesContext()
 {
 }
 
-SvXMLImportContext *ScXMLSubTotalRulesContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSubTotalRulesContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext = nullptr;
 
-    const SvXMLTokenMap& rTokenMap = GetScImport().GetDatabaseRangeSubTotalRulesElemTokenMap();
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_SUBTOTAL_RULES_SORT_GROUPS :
+        case XML_ELEMENT( TABLE, XML_SORT_GROUPS ):
         {
-            pContext = new ScXMLSortGroupsContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, pDatabaseRangeContext);
+            pContext = new ScXMLSortGroupsContext( GetScImport(), nElement, xAttrList, pDatabaseRangeContext);
         }
         break;
-        case XML_TOK_SUBTOTAL_RULES_SUBTOTAL_RULE :
+        case XML_ELEMENT( TABLE, XML_SUBTOTAL_RULE ):
         {
-            pContext = new ScXMLSubTotalRuleContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, pDatabaseRangeContext);
+            pContext = new ScXMLSubTotalRuleContext( GetScImport(), nElement, xAttrList, pDatabaseRangeContext);
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
 
-void ScXMLSubTotalRulesContext::EndElement()
-{
-}
-
 ScXMLSortGroupsContext::ScXMLSortGroupsContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pDatabaseRangeContext(pTempDatabaseRangeContext)
 {
     pDatabaseRangeContext->SetSubTotalsSortGroups(true);
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetSubTotalRulesSortGroupsAttrTokenMap();
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName );
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_SORT_GROUPS_ATTR_DATA_TYPE :
+            switch (aIter.getToken())
             {
-                if (sValue.getLength() > 8)
+                case XML_ELEMENT( TABLE, XML_DATA_TYPE ):
                 {
-                    OUString sTemp = sValue.copy(0, 8);
-                    if (sTemp == "UserList")
+                    const OUString &sValue = aIter.toString();
+                    if (sValue.getLength() > 8)
                     {
-                        pDatabaseRangeContext->SetSubTotalsEnabledUserList(true);
-                        sTemp = sValue.copy(8);
-                        pDatabaseRangeContext->SetSubTotalsUserListIndex(static_cast<sal_Int16>(sTemp.toInt32()));
+                        OUString sTemp = sValue.copy(0, 8);
+                        if (sTemp == "UserList")
+                        {
+                            pDatabaseRangeContext->SetSubTotalsEnabledUserList(true);
+                            sTemp = sValue.copy(8);
+                            pDatabaseRangeContext->SetSubTotalsUserListIndex(static_cast<sal_Int16>(sTemp.toInt32()));
+                        }
+                        else
+                        {
+                            //if (IsXMLToken(aIter, XML_AUTOMATIC))
+                                //aSortField.FieldType = util::SortFieldType_AUTOMATIC;
+                                // is not supported by StarOffice
+                        }
                     }
                     else
                     {
-                        //if (IsXMLToken(sValue, XML_AUTOMATIC))
-                            //aSortField.FieldType = util::SortFieldType_AUTOMATIC;
+                        //if (IsXMLToken(aIter, XML_TEXT))
+                            //aSortField.FieldType = util::SortFieldType_ALPHANUMERIC;
+                            // is not supported by StarOffice
+                        //else if (IsXMLToken(aIter, XML_NUMBER))
+                            //aSortField.FieldType = util::SortFieldType_NUMERIC;
                             // is not supported by StarOffice
                     }
                 }
-                else
+                break;
+                case XML_ELEMENT( TABLE, XML_ORDER ):
                 {
-                    //if (IsXMLToken(sValue, XML_TEXT))
-                        //aSortField.FieldType = util::SortFieldType_ALPHANUMERIC;
-                        // is not supported by StarOffice
-                    //else if (IsXMLToken(sValue, XML_NUMBER))
-                        //aSortField.FieldType = util::SortFieldType_NUMERIC;
-                        // is not supported by StarOffice
+                    if (IsXMLToken(aIter, XML_ASCENDING))
+                        pDatabaseRangeContext->SetSubTotalsAscending(true);
+                    else
+                        pDatabaseRangeContext->SetSubTotalsAscending(false);
                 }
+                break;
             }
-            break;
-            case XML_TOK_SORT_GROUPS_ATTR_ORDER :
-            {
-                if (IsXMLToken(sValue, XML_ASCENDING))
-                    pDatabaseRangeContext->SetSubTotalsAscending(true);
-                else
-                    pDatabaseRangeContext->SetSubTotalsAscending(false);
-            }
-            break;
         }
     }
 }
@@ -849,42 +774,32 @@ ScXMLSortGroupsContext::~ScXMLSortGroupsContext()
 {
 }
 
-SvXMLImportContext *ScXMLSortGroupsContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
-{
-    return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
-void ScXMLSortGroupsContext::EndElement()
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSortGroupsContext::createFastChildContext(
+    sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
 {
+    return new SvXMLImportContext( GetImport() );
 }
 
 ScXMLSubTotalRuleContext::ScXMLSubTotalRuleContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pDatabaseRangeContext(pTempDatabaseRangeContext)
 {
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetSubTotalRulesSubTotalRuleAttrTokenMap();
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName );
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_SUBTOTAL_RULE_ATTR_GROUP_BY_FIELD_NUMBER :
+            switch (aIter.getToken())
             {
-                aSubTotalRule.nSubTotalRuleGroupFieldNumber = static_cast<sal_Int16>(sValue.toInt32());
+                case XML_ELEMENT( TABLE, XML_GROUP_BY_FIELD_NUMBER ):
+                    aSubTotalRule.nSubTotalRuleGroupFieldNumber = static_cast<sal_Int16>(aIter.toInt32());
+                    break;
             }
-            break;
         }
     }
 }
@@ -893,65 +808,55 @@ ScXMLSubTotalRuleContext::~ScXMLSubTotalRuleContext()
 {
 }
 
-SvXMLImportContext *ScXMLSubTotalRuleContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSubTotalRuleContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext = nullptr;
 
-    const SvXMLTokenMap& rTokenMap = GetScImport().GetSubTotalRulesSubTotalRuleElemTokenMap();
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_SUBTOTAL_RULE_SUBTOTAL_FIELD :
+        case XML_ELEMENT( TABLE, XML_SUBTOTAL_FIELD ):
         {
-            pContext = new ScXMLSubTotalFieldContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, this);
+            pContext = new ScXMLSubTotalFieldContext( GetScImport(), nElement, xAttrList, this);
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
 
-void ScXMLSubTotalRuleContext::EndElement()
+void SAL_CALL ScXMLSubTotalRuleContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     if (pDatabaseRangeContext)
         pDatabaseRangeContext->AddSubTotalRule(aSubTotalRule);
 }
 
 ScXMLSubTotalFieldContext::ScXMLSubTotalFieldContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLSubTotalRuleContext* pTempSubTotalRuleContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pSubTotalRuleContext(pTempSubTotalRuleContext)
 {
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetSubTotalRuleSubTotalFieldAttrTokenMap();
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName );
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_SUBTOTAL_FIELD_ATTR_FIELD_NUMBER :
-            {
-                sFieldNumber = sValue;
-            }
-            break;
-            case XML_TOK_SUBTOTAL_FIELD_ATTR_FUNCTION :
+            switch (aIter.getToken())
             {
-                sFunction = sValue;
+                case XML_ELEMENT( TABLE, XML_FIELD_NUMBER ):
+                    sFieldNumber = aIter.toString();
+                    break;
+                case XML_ELEMENT( TABLE, XML_FUNCTION ):
+                    sFunction = aIter.toString();
+                    break;
             }
-            break;
         }
     }
 }
@@ -960,14 +865,13 @@ ScXMLSubTotalFieldContext::~ScXMLSubTotalFieldContext()
 {
 }
 
-SvXMLImportContext *ScXMLSubTotalFieldContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSubTotalFieldContext::createFastChildContext(
+    sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
 {
-    return new SvXMLImportContext( GetImport(), nPrefix, rLName );
+    return new SvXMLImportContext( GetImport() );
 }
 
-void ScXMLSubTotalFieldContext::EndElement()
+void SAL_CALL ScXMLSubTotalFieldContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     sheet::SubTotalColumn aSubTotalColumn;
     aSubTotalColumn.Column = sFieldNumber.toInt32();
diff --git a/sc/source/filter/xml/xmldrani.hxx b/sc/source/filter/xml/xmldrani.hxx
index 65d5bd64a35f..0033ede753e6 100644
--- a/sc/source/filter/xml/xmldrani.hxx
+++ b/sc/source/filter/xml/xmldrani.hxx
@@ -98,9 +98,8 @@ public:
 
     virtual ~ScXMLDatabaseRangeContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
     virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 
@@ -129,18 +128,16 @@ class ScXMLSourceSQLContext : public ScXMLImportContext
 
 public:
 
-    ScXMLSourceSQLContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLSourceSQLContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
 
     virtual ~ScXMLSourceSQLContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 class ScXMLSourceTableContext : public ScXMLImportContext
@@ -150,18 +147,16 @@ class ScXMLSourceTableContext : public ScXMLImportContext
 
 public:
 
-    ScXMLSourceTableContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLSourceTableContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
 
     virtual ~ScXMLSourceTableContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 class ScXMLSourceQueryContext : public ScXMLImportContext
@@ -171,18 +166,16 @@ class ScXMLSourceQueryContext : public ScXMLImportContext
 
 public:
 
-    ScXMLSourceQueryContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLSourceQueryContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
 
     virtual ~ScXMLSourceQueryContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 class ScXMLConResContext : public ScXMLImportContext
@@ -191,18 +184,14 @@ class ScXMLConResContext : public ScXMLImportContext
 
 public:
 
-    ScXMLConResContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLConResContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
 
     virtual ~ScXMLConResContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
-
-    virtual void EndElement() override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 };
 
 class ScXMLSubTotalRulesContext : public ScXMLImportContext
@@ -211,19 +200,15 @@ class ScXMLSubTotalRulesContext : public ScXMLImportContext
 
 public:
 
-    ScXMLSubTotalRulesContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
+    ScXMLSubTotalRulesContext( ScXMLImport& rImport, sal_Int32 nElement,
                         const css::uno::Reference<
-                                        css::xml::sax::XAttributeList>& xAttrList,
+                                        css::xml::sax::XFastAttributeList>& xAttrList,
                                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
 
     virtual ~ScXMLSubTotalRulesContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
-
-    virtual void EndElement() override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 };
 
 class ScXMLSortGroupsContext : public ScXMLImportContext
@@ -232,18 +217,14 @@ class ScXMLSortGroupsContext : public ScXMLImportContext
 
 public:
 
-    ScXMLSortGroupsContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLSortGroupsContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
 
     virtual ~ScXMLSortGroupsContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
-
-    virtual void EndElement() override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 };
 
 class ScXMLSubTotalRuleContext : public ScXMLImportContext
@@ -253,18 +234,16 @@ class ScXMLSubTotalRuleContext : public ScXMLImportContext
 
 public:
 
-    ScXMLSubTotalRuleContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLSubTotalRuleContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
 
     virtual ~ScXMLSubTotalRuleContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 
     void AddSubTotalColumn(const css::sheet::SubTotalColumn& rSubTotalColumn)
     { aSubTotalRule.aSubTotalColumns.realloc(aSubTotalRule.aSubTotalColumns.getLength() + 1);
@@ -279,18 +258,16 @@ class ScXMLSubTotalFieldContext : public ScXMLImportContext
 
 public:
 
-    ScXMLSubTotalFieldContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLSubTotalFieldContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLSubTotalRuleContext* pSubTotalRuleContext);
 
     virtual ~ScXMLSubTotalFieldContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 #endif
diff --git a/sc/source/filter/xml/xmlfilti.cxx b/sc/source/filter/xml/xmlfilti.cxx
index 2a846cdab262..43c8296e3d95 100644
--- a/sc/source/filter/xml/xmlfilti.cxx
+++ b/sc/source/filter/xml/xmlfilti.cxx
@@ -30,6 +30,7 @@
 #include <xmloff/xmltkmap.hxx>
 #include <xmloff/nmspmap.hxx>
 #include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlnmspe.hxx>
 
 using namespace com::sun::star;
 using namespace xmloff::token;
@@ -40,12 +41,11 @@ using ::com::sun::star::xml::sax::XAttributeList;
 ScXMLFilterContext::ConnStackItem::ConnStackItem(bool bOr) : mbOr(bOr), mnCondCount(0) {}
 
 ScXMLFilterContext::ScXMLFilterContext( ScXMLImport& rImport,
-                                        sal_uInt16 nPrfx,
-                                        const OUString& rLName,
-                                        const Reference<XAttributeList>& xAttrList,
+                                        sal_Int32 /*nElement*/,
+                                        const Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                         ScQueryParam& rParam,
                                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     mrQueryParam(rParam),
     pDatabaseRangeContext(pTempDatabaseRangeContext),
     bSkipDuplicates(false),
@@ -54,46 +54,44 @@ ScXMLFilterContext::ScXMLFilterContext( ScXMLImport& rImport,
 {
     ScDocument* pDoc(GetScImport().GetDocument());
 
-    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetFilterAttrTokenMap();
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName );
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_FILTER_ATTR_TARGET_RANGE_ADDRESS :
+            switch (aIter.getToken())
             {
-                ScRange aScRange;
-                sal_Int32 nOffset(0);
-                if (ScRangeStringConverter::GetRangeFromString( aScRange, sValue, pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset ))
+                case XML_ELEMENT( TABLE, XML_TARGET_RANGE_ADDRESS ):
                 {
-                    aOutputPosition = aScRange.aStart;
-                    bCopyOutputData = true;
+                    ScRange aScRange;
+                    sal_Int32 nOffset(0);
+                    if (ScRangeStringConverter::GetRangeFromString( aScRange, aIter.toString(), pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset ))
+                    {
+                        aOutputPosition = aScRange.aStart;
+                        bCopyOutputData = true;
+                    }
                 }
+                break;
+                case XML_ELEMENT( TABLE, XML_CONDITION_SOURCE_RANGE_ADDRESS ):
+                {
+                    sal_Int32 nOffset(0);
+                    if (ScRangeStringConverter::GetRangeFromString( aConditionSourceRangeAddress, aIter.toString(), pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset ) )
+                        bConditionSourceRange = true;
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_CONDITION_SOURCE ):
+                {
+                    // not supported by StarOffice
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_DISPLAY_DUPLICATES ):
+                {
+                    bSkipDuplicates = !IsXMLToken(aIter, XML_TRUE);
+                }
+                break;
             }
-            break;
-            case XML_TOK_FILTER_ATTR_CONDITION_SOURCE_RANGE_ADDRESS :
-            {
-                sal_Int32 nOffset(0);
-                if (ScRangeStringConverter::GetRangeFromString( aConditionSourceRangeAddress, sValue, pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset ) )
-                    bConditionSourceRange = true;
-            }
-            break;
-            case XML_TOK_FILTER_ATTR_CONDITION_SOURCE :
-            {
-                // not supported by StarOffice
-            }
-            break;
-            case XML_TOK_FILTER_ATTR_DISPLAY_DUPLICATES :
-            {
-                bSkipDuplicates = !IsXMLToken(sValue, XML_TRUE);
-            }
-            break;
         }
     }
 }
@@ -137,7 +135,7 @@ SvXMLImportContext *ScXMLFilterContext::CreateChildContext( sal_uInt16 nPrefix,
     return pContext;
 }
 
-void ScXMLFilterContext::EndElement()
+void SAL_CALL ScXMLFilterContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     mrQueryParam.bInplace = !bCopyOutputData;
     mrQueryParam.bDuplicate = !bSkipDuplicates;
diff --git a/sc/source/filter/xml/xmlfilti.hxx b/sc/source/filter/xml/xmlfilti.hxx
index 757758175103..29d2d3416f75 100644
--- a/sc/source/filter/xml/xmlfilti.hxx
+++ b/sc/source/filter/xml/xmlfilti.hxx
@@ -55,9 +55,8 @@ class ScXMLFilterContext : public ScXMLImportContext
 
 public:
 
-    ScXMLFilterContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLFilterContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScQueryParam& rParam,
                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
 
@@ -67,7 +66,7 @@ public:
                                      const OUString& rLocalName,
                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 
     void OpenConnection(bool b);
     void CloseConnection();
diff --git a/sc/source/filter/xml/xmlnexpi.cxx b/sc/source/filter/xml/xmlnexpi.cxx
index 5f7f4735e113..b6a8f507699f 100644
--- a/sc/source/filter/xml/xmlnexpi.cxx
+++ b/sc/source/filter/xml/xmlnexpi.cxx
@@ -25,10 +25,10 @@
 #include "docuno.hxx"
 #include "document.hxx"
 
-#include <xmloff/xmltkmap.hxx>
-#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlnmspe.hxx>
 
 using namespace com::sun::star;
+using namespace xmloff::token;
 
 ScXMLNamedExpressionsContext::GlobalInserter::GlobalInserter(ScXMLImport& rImport) : mrImport(rImport) {}
 
@@ -61,38 +61,35 @@ ScXMLNamedExpressionsContext::~ScXMLNamedExpressionsContext()
     GetScImport().UnlockSolarMutex();
 }
 
-SvXMLImportContext *ScXMLNamedExpressionsContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLNamedExpressionsContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetNamedExpressionsElemTokenMap());
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-    case XML_TOK_NAMED_EXPRESSIONS_NAMED_RANGE:
-        pContext = new ScXMLNamedRangeContext(
-            GetScImport(), nPrefix, rLName, xAttrList, mpInserter.get() );
-        break;
-    case XML_TOK_NAMED_EXPRESSIONS_NAMED_EXPRESSION:
-        pContext = new ScXMLNamedExpressionContext(
-            GetScImport(), nPrefix, rLName, xAttrList, mpInserter.get() );
-        break;
+        case XML_ELEMENT( TABLE, XML_NAMED_RANGE ):
+            pContext = new ScXMLNamedRangeContext(
+                GetScImport(), nElement, xAttrList, mpInserter.get() );
+            break;
+        case XML_ELEMENT( TABLE, XML_NAMED_EXPRESSION ):
+            pContext = new ScXMLNamedExpressionContext(
+                GetScImport(), nElement, xAttrList, mpInserter.get() );
+            break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
 
 ScXMLNamedRangeContext::ScXMLNamedRangeContext(
     ScXMLImport& rImport,
-    sal_uInt16 nPrfx,
-    const OUString& rLName,
-    const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+    sal_Int32 /*nElement*/,
+    const uno::Reference<xml::sax::XFastAttributeList>& xAttrList,
     ScXMLNamedExpressionsContext::Inserter* pInserter ) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     mpInserter(pInserter)
 {
     if (!mpInserter)
@@ -104,38 +101,29 @@ ScXMLNamedRangeContext::ScXMLNamedRangeContext(
     pNamedExpression->eGrammar = formula::FormulaGrammar::mergeToGrammar(
             GetScImport().GetDocument()->GetStorageGrammar(),
             formula::FormulaGrammar::CONV_OOO);
-    sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
-    const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetNamedRangeAttrTokenMap();
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName ));
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_NAMED_RANGE_ATTR_NAME :
+            switch (aIter.getToken())
             {
-                pNamedExpression->sName = sValue;
+                case XML_ELEMENT( TABLE, XML_NAME ):
+                    pNamedExpression->sName = aIter.toString();
+                    break;
+                case XML_ELEMENT( TABLE, XML_CELL_RANGE_ADDRESS ):
+                    pNamedExpression->sContent = aIter.toString();
+                    break;
+                case XML_ELEMENT( TABLE, XML_BASE_CELL_ADDRESS ):
+                    pNamedExpression->sBaseCellAddress = aIter.toString();
+                    break;
+                case XML_ELEMENT( TABLE, XML_RANGE_USABLE_AS ):
+                    pNamedExpression->sRangeType = aIter.toString();
+                    break;
             }
-            break;
-            case XML_TOK_NAMED_RANGE_ATTR_CELL_RANGE_ADDRESS :
-            {
-                pNamedExpression->sContent = sValue;
-            }
-            break;
-            case XML_TOK_NAMED_RANGE_ATTR_BASE_CELL_ADDRESS :
-            {
-                pNamedExpression->sBaseCellAddress = sValue;
-            }
-            break;
-            case XML_TOK_NAMED_RANGE_ATTR_RANGE_USABLE_AS :
-            {
-                pNamedExpression->sRangeType = sValue;
-            }
-            break;
         }
     }
     pNamedExpression->bIsExpression = false;
@@ -146,57 +134,45 @@ ScXMLNamedRangeContext::~ScXMLNamedRangeContext()
 {
 }
 
-SvXMLImportContext *ScXMLNamedRangeContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
-{
-    return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
-void ScXMLNamedRangeContext::EndElement()
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLNamedRangeContext::createFastChildContext(
+    sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
 {
+    return new SvXMLImportContext( GetImport() );
 }
 
 ScXMLNamedExpressionContext::ScXMLNamedExpressionContext(
-    ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
-    const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+    ScXMLImport& rImport, sal_Int32 /*nElement*/,
+    const uno::Reference<xml::sax::XFastAttributeList>& xAttrList,
     ScXMLNamedExpressionsContext::Inserter* pInserter ) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     mpInserter(pInserter)
 {
     if (!mpInserter)
         return;
 
     ScMyNamedExpression* pNamedExpression(new ScMyNamedExpression);
-    sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
-    const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetNamedExpressionAttrTokenMap());
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName ));
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_NAMED_EXPRESSION_ATTR_NAME :
-            {
-                pNamedExpression->sName = sValue;
-            }
-            break;
-            case XML_TOK_NAMED_EXPRESSION_ATTR_EXPRESSION :
+            switch (aIter.getToken())
             {
-                GetScImport().ExtractFormulaNamespaceGrammar(
-                    pNamedExpression->sContent, pNamedExpression->sContentNmsp,
-                    pNamedExpression->eGrammar, sValue );
+                case XML_ELEMENT( TABLE, XML_NAME ):
+                    pNamedExpression->sName = aIter.toString();
+                    break;
+                case XML_ELEMENT( TABLE, XML_EXPRESSION ):
+                    GetScImport().ExtractFormulaNamespaceGrammar(
+                        pNamedExpression->sContent, pNamedExpression->sContentNmsp,
+                        pNamedExpression->eGrammar, aIter.toString() );
+                    break;
+                case XML_ELEMENT( TABLE, XML_BASE_CELL_ADDRESS ):
+                    pNamedExpression->sBaseCellAddress = aIter.toString();
+                    break;
             }
-            break;
-            case XML_TOK_NAMED_EXPRESSION_ATTR_BASE_CELL_ADDRESS :
-            {
-                pNamedExpression->sBaseCellAddress = sValue;
-            }
-            break;
         }
     }
     pNamedExpression->bIsExpression = true;
@@ -207,16 +183,10 @@ ScXMLNamedExpressionContext::~ScXMLNamedExpressionContext()
 {
 }
 
-SvXMLImportContext *ScXMLNamedExpressionContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<
-                                        css::xml::sax::XAttributeList>& /* xAttrList */ )
-{
-    return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
-void ScXMLNamedExpressionContext::EndElement()
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLNamedExpressionContext::createFastChildContext(
+    sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
 {
+    return new SvXMLImportContext( GetImport() );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/xmlnexpi.hxx b/sc/source/filter/xml/xmlnexpi.hxx
index 3df717f674ff..2a6be588e732 100644
--- a/sc/source/filter/xml/xmlnexpi.hxx
+++ b/sc/source/filter/xml/xmlnexpi.hxx
@@ -76,9 +76,8 @@ public:
 
     virtual ~ScXMLNamedExpressionsContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
 private:
     std::shared_ptr<Inserter> mpInserter;
@@ -89,17 +88,14 @@ class ScXMLNamedRangeContext : public ScXMLImportContext
 public:
 
     ScXMLNamedRangeContext(
-        ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
-        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+        ScXMLImport& rImport, sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
         ScXMLNamedExpressionsContext::Inserter* pInserter );
 
     virtual ~ScXMLNamedRangeContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
-
-    virtual void EndElement() override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
 private:
     ScXMLNamedExpressionsContext::Inserter* mpInserter;
@@ -110,17 +106,14 @@ class ScXMLNamedExpressionContext : public ScXMLImportContext
 public:
 
     ScXMLNamedExpressionContext(
-        ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
-        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+        ScXMLImport& rImport, sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
         ScXMLNamedExpressionsContext::Inserter* pInserter );
 
     virtual ~ScXMLNamedExpressionContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
-
-    virtual void EndElement() override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
 
 private:
     ScXMLNamedExpressionsContext::Inserter* mpInserter;
diff --git a/sc/source/filter/xml/xmlsorti.cxx b/sc/source/filter/xml/xmlsorti.cxx
index 36705555e8a3..3f97cb99527a 100644
--- a/sc/source/filter/xml/xmlsorti.cxx
+++ b/sc/source/filter/xml/xmlsorti.cxx
@@ -28,17 +28,17 @@
 #include <xmloff/xmltkmap.hxx>
 #include <xmloff/nmspmap.hxx>
 #include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlnmspe.hxx>
 
 using namespace com::sun::star;
 using namespace xmloff::token;
 
 ScXMLSortContext::ScXMLSortContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
+                                      sal_Int32 /*nElement*/,
                                       const css::uno::Reference<
-                                      css::xml::sax::XAttributeList>& xAttrList,
+                                      css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pDatabaseRangeContext(pTempDatabaseRangeContext),
     sAlgorithm(),
     nUserListIndex(0),
@@ -47,54 +47,62 @@ ScXMLSortContext::ScXMLSortContext( ScXMLImport& rImport,
     bIsCaseSensitive(false),
     bEnabledUserList(false)
 {
-    sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
-    const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetSortAttrTokenMap());
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName ));
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_SORT_ATTR_BIND_STYLES_TO_CONTENT :
+            switch (aIter.getToken())
             {
-                bBindFormatsToContent = IsXMLToken(sValue, XML_TRUE);
-            }
-            break;
-            case XML_TOK_SORT_ATTR_TARGET_RANGE_ADDRESS :
-            {
-                ScRange aScRange;
-                sal_Int32 nOffset(0);
-                if (ScRangeStringConverter::GetRangeFromString( aScRange, sValue, GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset ))
+                case XML_ELEMENT( TABLE, XML_BIND_STYLES_TO_CONTENT ):
                 {
-                    ScUnoConversion::FillApiAddress( aOutputPosition, aScRange.aStart );
-                    bCopyOutputData = true;
+                    bBindFormatsToContent = IsXMLToken(aIter, XML_TRUE);
                 }
+                break;
+                case XML_ELEMENT( TABLE, XML_TARGET_RANGE_ADDRESS ):
+                {
+                    ScRange aScRange;
+                    sal_Int32 nOffset(0);
+                    if (ScRangeStringConverter::GetRangeFromString( aScRange, aIter.toString(), GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset ))
+                    {
+                        ScUnoConversion::FillApiAddress( aOutputPosition, aScRange.aStart );
+                        bCopyOutputData = true;
+                    }
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_CASE_SENSITIVE ):
+                {
+                    bIsCaseSensitive = IsXMLToken(aIter, XML_TRUE);
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_RFC_LANGUAGE_TAG ):
+                {
+                    maLanguageTagODF.maRfcLanguageTag = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_LANGUAGE ):
+                {
+                    maLanguageTagODF.maLanguage = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_SCRIPT ):
+                {
+                    maLanguageTagODF.maScript = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_COUNTRY ):
+                {
+                    maLanguageTagODF.maCountry = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_ALGORITHM ):
+                {
+                    sAlgorithm = aIter.toString();
+                }
+                break;
             }
-            break;
-            case XML_TOK_SORT_ATTR_CASE_SENSITIVE :
-            {
-                bIsCaseSensitive = IsXMLToken(sValue, XML_TRUE);
-            }
-            break;
-            case XML_TOK_SORT_ATTR_RFC_LANGUAGE_TAG :
-                maLanguageTagODF.maRfcLanguageTag = sValue;
-            break;
-            case XML_TOK_SORT_ATTR_LANGUAGE :
-                maLanguageTagODF.maLanguage = sValue;
-            break;
-            case XML_TOK_SORT_ATTR_SCRIPT :
-                maLanguageTagODF.maScript = sValue;
-            break;
-            case XML_TOK_SORT_ATTR_COUNTRY :
-                maLanguageTagODF.maCountry = sValue;
-            break;
-            case XML_TOK_SORT_ATTR_ALGORITHM :
-                sAlgorithm = sValue;
-            break;
         }
     }
 }
@@ -126,7 +134,7 @@ SvXMLImportContext *ScXMLSortContext::CreateChildContext( sal_uInt16 nPrefix,
     return pContext;
 }
 
-void ScXMLSortContext::EndElement()
+void SAL_CALL ScXMLSortContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     sal_Int32 nAlgoLength(sAlgorithm.getLength());
     sal_uInt8 i (0);
diff --git a/sc/source/filter/xml/xmlsorti.hxx b/sc/source/filter/xml/xmlsorti.hxx
index ce2b2b381b16..25fb1856fcbf 100644
--- a/sc/source/filter/xml/xmlsorti.hxx
+++ b/sc/source/filter/xml/xmlsorti.hxx
@@ -46,9 +46,8 @@ class ScXMLSortContext : public ScXMLImportContext
 
 public:
 
-    ScXMLSortContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLSortContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
 
     virtual ~ScXMLSortContext() override;
@@ -57,7 +56,7 @@ public:
                                      const OUString& rLocalName,
                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 
     void AddSortField(const OUString& sFieldNumber, const OUString& sDataType, const OUString& sOrder);
 };


More information about the Libreoffice-commits mailing list