comphelper/source/xml/attributelist.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit da8d369a1fb06dfe6ef47d6e0da4402bb12ede27 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Jan 24 08:52:01 2023 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Jan 24 09:46:52 2023 +0000 AddAttribute may take 'namespace:full:uri^attribute_name' ... e.g., created in SaxNamespaceFilter::startElement, which calls XMLNamespaces::applyNSToAttributeName to make such a name. See https://gerrit.libreoffice.org/c/core/+/145526/comments/26536db2_d8fb1e1b, which notified that the assert from f2f008c52aaa88329c07f441de60d6fdfce9f0b3 ("Merge SvXMLAttributeList to comphelper::AttributeList", 2023-01-15) started to fail on some input. Change-Id: Ia0afc167aefac463bcd354dc009bff6e14a64dfa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146054 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/comphelper/source/xml/attributelist.cxx b/comphelper/source/xml/attributelist.cxx index 69f8a2aca62c..664dcf569097 100644 --- a/comphelper/source/xml/attributelist.cxx +++ b/comphelper/source/xml/attributelist.cxx @@ -65,7 +65,10 @@ css::uno::Reference< css::util::XCloneable > AttributeList::createClone() void AttributeList::AddAttribute(const OUString& sName, const OUString& sValue) { assert(!sName.isEmpty() && "empty attribute name is invalid"); - assert(std::count(sName.getStr(), sName.getStr() + sName.getLength(), u':') <= 1 + // Either it's 'namespace_prefix:attribute_name', + // or as in XMLNamespaces::applyNSToAttributeName, it's 'namespace:full:uri^attribute_name'. + assert((std::count(sName.getStr(), sName.getStr() + sName.getLength(), u':') <= 1 + || std::count(sName.getStr(), sName.getStr() + sName.getLength(), u'^') == 1) && "too many colons"); // TODO: this assertion fails in tests! // assert(std::none_of(mAttributes.begin(), mAttributes.end(),