summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/xmloff/xmlimp.hxx2
-rw-r--r--xmloff/source/core/xmlictxt.cxx16
-rw-r--r--xmloff/source/core/xmlimp.cxx10
3 files changed, 20 insertions, 8 deletions
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index f7137715ced3..37b1d1589d88 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -222,6 +222,8 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public cppu::WeakImplHelper<
bool isFastContext;
css::uno::Reference< css::xml::sax::XFastParser > mxParser;
rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler;
+ rtl::Reference < comphelper::AttributeList > maAttrList;
+ rtl::Reference < comphelper::AttributeList > maNamespaceAttrList;
css::uno::Reference< css::xml::sax::XFastDocumentHandler > mxFastDocumentHandler;
css::uno::Reference< css::xml::sax::XFastTokenHandler > mxTokenHandler;
std::unordered_map< sal_Int32, OUString > maNamespaceMap;
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index 63025083d78f..9a1d5bc0ea62 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -78,8 +78,14 @@ void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & rPrefix,
const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
{
OUString elementName;
- rtl::Reference < comphelper::AttributeList > rAttrList = new comphelper::AttributeList;
- mrImport.maNamespaceHandler->addNSDeclAttributes( rAttrList );
+
+ if ( mrImport.maAttrList.is() )
+ mrImport.maAttrList->Clear();
+ else
+ mrImport.maAttrList = new comphelper::AttributeList;
+
+ mrImport.maNamespaceHandler->addNSDeclAttributes( mrImport.maAttrList );
+
if ( !rPrefix.isEmpty() )
elementName = rPrefix + ":" + rLocalName;
else
@@ -102,7 +108,7 @@ void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & rPrefix,
if ( !rAttrNamespacePrefix.isEmpty() )
sAttrName = rAttrNamespacePrefix + ":" + sAttrName;
- rAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue );
+ mrImport.maAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue );
}
uno::Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes();
@@ -115,11 +121,11 @@ void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & rPrefix,
if ( !rAttrNamespacePrefix.isEmpty() )
sAttrName = rAttrNamespacePrefix + ":" + sAttrName;
- rAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue );
+ mrImport.maAttrList->AddAttribute( sAttrName, "CDATA", rAttrValue );
}
}
- mrImport.startElement( elementName, rAttrList.get() );
+ mrImport.startElement( elementName, mrImport.maAttrList.get() );
}
void SAL_CALL SvXMLImportContext::endFastElement(sal_Int32 nElement)
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index eba9d2ad21b6..2d489bc1cdb4 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -818,10 +818,14 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
if ( isFastContext )
{
- rtl::Reference < comphelper::AttributeList > rAttrList = new comphelper::AttributeList;
- maNamespaceHandler->addNSDeclAttributes( rAttrList );
+ if ( maNamespaceAttrList.is() )
+ maNamespaceAttrList->Clear();
+ else
+ maNamespaceAttrList = new comphelper::AttributeList;
+
+ maNamespaceHandler->addNSDeclAttributes( maNamespaceAttrList );
std::unique_ptr<SvXMLNamespaceMap> pRewindMap(
- processNSAttributes(rAttrList.get()));
+ processNSAttributes( maNamespaceAttrList.get() ));
SvXMLImportContext *pContext = dynamic_cast<SvXMLImportContext*>( xContext.get() );
if( pContext && pRewindMap )
pContext->PutRewindMap(std::move(pRewindMap));