summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-11-15 12:59:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-15 20:05:56 +0100
commit07caaab2e49d5fb409810025867b5ada6968c7e2 (patch)
treeaf044e04ae2e5641f42116d33bb3031c68c6d608 /xmloff
parent4f97022f9cb4eb2e6fd238cb27de792ef8cc29aa (diff)
fastparser in XMLDatabaseFieldImportContext
Change-Id: I83aba0cfcf2f280750b43e4782ec376572dacba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105895 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/txtfldi.hxx7
-rw-r--r--xmloff/source/text/txtfldi.cxx34
2 files changed, 19 insertions, 22 deletions
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 216c32ea677d..cedba840d6fc 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -361,10 +361,9 @@ public:
const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override;
/// handle database-location children
- virtual SvXMLImportContextRef 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 >& AttrList ) override;
};
/** import database name fields (<text:database-name>) */
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index fd643a6cd6ca..1622e0280933 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -1214,34 +1214,32 @@ void XMLDatabaseFieldImportContext::ProcessAttribute(
}
}
-SvXMLImportContextRef XMLDatabaseFieldImportContext::CreateChildContext(
- sal_uInt16 p_nPrefix,
- const OUString& rLocalName,
- const Reference<XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > XMLDatabaseFieldImportContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- if( ( p_nPrefix == XML_NAMESPACE_FORM ) &&
- IsXMLToken( rLocalName, XML_CONNECTION_RESOURCE ) )
+ if (nElement == XML_ELEMENT(FORM, XML_CONNECTION_RESOURCE) )
{
- // process attribute list directly
- sal_Int16 nLength = xAttrList->getLength();
- for( sal_Int16 n = 0; n < nLength; n++ )
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString sLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
- GetKeyByAttrName( xAttrList->getNameByIndex(n), &sLocalName );
-
- if( ( nPrefix == XML_NAMESPACE_XLINK ) &&
- IsXMLToken( sLocalName, XML_HREF ) )
+ switch (aIter.getToken())
{
- m_sDatabaseURL = xAttrList->getValueByIndex(n);
- m_bDatabaseOK = true;
- m_bDatabaseURLOK = true;
+ case XML_ELEMENT(XLINK, XML_HREF):
+ {
+ m_sDatabaseURL = aIter.toString();
+ m_bDatabaseOK = true;
+ m_bDatabaseURLOK = true;
+ }
+ break;
+ default:;
}
}
// we call ProcessAttribute in order to set bValid appropriately
ProcessAttribute( XML_TOKEN_INVALID, OUString() );
}
+ else
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
return nullptr;
}