summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmloff/source/core/xmlimp.cxx7
-rw-r--r--xmloff/source/style/xmlimppr.cxx3
2 files changed, 6 insertions, 4 deletions
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 2aeda90fc229..e56448adabd2 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -2261,12 +2261,13 @@ void SAL_CALL SvXMLLegacyToFastDocHandler::startElement( const OUString& rName,
OUString aNamespace;
const OUString& rAttrName = xAttrList->getNameByIndex( i );
const OUString& rAttrValue = xAttrList->getValueByIndex( i );
- sal_uInt16 const nAttrPrefix(mrImport->mpNamespaceMap->GetKeyByAttrName(
- rAttrName, nullptr, &aLocalAttrName, &aNamespace));
+ // don't add unknown namespaces to the map
+ sal_uInt16 const nAttrPrefix = mrImport->mpNamespaceMap->GetKeyByQName(
+ rAttrName, nullptr, &aLocalAttrName, &aNamespace, SvXMLNamespaceMap::QNameMode::AttrValue);
if( XML_NAMESPACE_XMLNS != nAttrPrefix )
{
auto const nToken = SvXMLImport::getTokenFromName(aLocalAttrName);
- if (nToken == xmloff::XML_TOKEN_INVALID)
+ if (XML_NAMESPACE_UNKNOWN == nAttrPrefix || nToken == xmloff::XML_TOKEN_INVALID)
{
mxFastAttributes->addUnknown(aNamespace,
OUStringToOString(rAttrName, RTL_TEXTENCODING_UTF8),
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
index a0886b18bd2d..0b327c73e6cc 100644
--- a/xmloff/source/style/xmlimppr.cxx
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -147,7 +147,8 @@ void SvXMLImportPropertyMapper::importXML(
{
// If it's an unknown attribute in a known namespace, ignore it.
OUString aPrefix = rAttribute.Name.copy(0, nSepIndex);
- if (rNamespaceMap.GetKeyByPrefix(aPrefix) != USHRT_MAX)
+ auto nKey = rNamespaceMap.GetKeyByPrefix(aPrefix);
+ if (nKey != USHRT_MAX && !(nKey & XML_NAMESPACE_UNKNOWN_FLAG))
continue;
}