summaryrefslogtreecommitdiff
path: root/xmloff/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-11-08 15:26:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-08 16:52:53 +0100
commit10e0a94416094e9c73b4152989481b89afd8b141 (patch)
tree487550175fb5ceca72027e8823a1f3ccd353bc1b /xmloff/source/core
parentd63b3561efb6b01a11b4a26a0e1e609699915b4d (diff)
dont call StartElement from startUnknownElement
to avoid having the StartElement/endFastElement call pairs end up unbalanced. Change-Id: I331aa48e3fd928a093d1f6b3248d9f9668ef83ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105442 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/core')
-rw-r--r--xmloff/source/core/xmlictxt.cxx47
1 files changed, 22 insertions, 25 deletions
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index 69fce5c5208a..5c75a964caef 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -70,39 +70,36 @@ void SAL_CALL SvXMLImportContext::startFastElement(sal_Int32 nElement, const uno
const OUString& rPrefix = SvXMLImport::getNamespacePrefixFromToken(nElement, &GetImport().GetNamespaceMap());
const OUString& rLocalName = SvXMLImport::getNameFromToken( nElement );
startUnknownElement( SvXMLImport::aDefaultNamespace, (rPrefix.isEmpty())? rLocalName : rPrefix + SvXMLImport::aNamespaceSeparator + rLocalName, Attribs );
-}
-
-void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & /*rNamespace*/, const OUString & /*rElementName*/,
- const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-{
mrImport.maAttrList->Clear();
mrImport.maNamespaceHandler->addNSDeclAttributes( mrImport.maAttrList );
- if ( Attribs.is() )
+ for( auto &it : sax_fastparser::castToFastAttributeList( Attribs ) )
+ {
+ sal_Int32 nToken = it.getToken();
+ const OUString& rAttrNamespacePrefix = SvXMLImport::getNamespacePrefixFromToken(nToken, &GetImport().GetNamespaceMap());
+ OUString sAttrName = SvXMLImport::getNameFromToken( nToken );
+ if ( !rAttrNamespacePrefix.isEmpty() )
+ sAttrName = rAttrNamespacePrefix + SvXMLImport::aNamespaceSeparator + sAttrName;
+
+ mrImport.maAttrList->AddAttribute( sAttrName, "CDATA", it.toString() );
+ }
+
+ const uno::Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes();
+ for ( const auto& rUnknownAttrib : unknownAttribs )
{
- for( auto &it : sax_fastparser::castToFastAttributeList( Attribs ) )
- {
- sal_Int32 nToken = it.getToken();
- const OUString& rAttrNamespacePrefix = SvXMLImport::getNamespacePrefixFromToken(nToken, &GetImport().GetNamespaceMap());
- OUString sAttrName = SvXMLImport::getNameFromToken( nToken );
- if ( !rAttrNamespacePrefix.isEmpty() )
- sAttrName = rAttrNamespacePrefix + SvXMLImport::aNamespaceSeparator + sAttrName;
-
- mrImport.maAttrList->AddAttribute( sAttrName, "CDATA", it.toString() );
- }
-
- const uno::Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes();
- for ( const auto& rUnknownAttrib : unknownAttribs )
- {
- const OUString& rAttrValue = rUnknownAttrib.Value;
- const OUString& rAttrName = rUnknownAttrib.Name;
- // note: rAttrName is expected to be namespace-prefixed here
- mrImport.maAttrList->AddAttribute( rAttrName, "CDATA", rAttrValue );
- }
+ const OUString& rAttrValue = rUnknownAttrib.Value;
+ const OUString& rAttrName = rUnknownAttrib.Name;
+ // note: rAttrName is expected to be namespace-prefixed here
+ mrImport.maAttrList->AddAttribute( rAttrName, "CDATA", rAttrValue );
}
StartElement( mrImport.maAttrList.get() );
}
+void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & /*rNamespace*/, const OUString & /*rElementName*/,
+ const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
+{
+}
+
void SAL_CALL SvXMLImportContext::endUnknownElement (const OUString & /*rNamespace*/, const OUString & /*rElementName*/)
{
}