Simplify a bit
Change-Id: I224602738ce41529cc5eca681f09db31241a5cac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175385 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
parent
dd18703696
commit
7a7b1f9cbd
1 changed files with 4 additions and 6 deletions
|
@ -33,17 +33,15 @@ void XMLNamespaces::addNamespace( const OUString& aName, const OUString& aValue
|
|||
OUString aNamespaceName( aName );
|
||||
|
||||
// delete preceding "xmlns"
|
||||
constexpr char aXMLAttributeNamespace[] = "xmlns";
|
||||
if ( aNamespaceName.startsWith( aXMLAttributeNamespace ) )
|
||||
if (std::u16string_view rest; aNamespaceName.startsWith("xmlns", &rest))
|
||||
{
|
||||
constexpr sal_Int32 nXMLNamespaceLength = RTL_CONSTASCII_LENGTH(aXMLAttributeNamespace);
|
||||
if ( aNamespaceName.getLength() == nXMLNamespaceLength )
|
||||
if (rest.empty())
|
||||
{
|
||||
aNamespaceName.clear();
|
||||
}
|
||||
else if ( aNamespaceName.getLength() >= nXMLNamespaceLength+2 )
|
||||
else if (rest.size() > 1)
|
||||
{
|
||||
aNamespaceName = aNamespaceName.copy( nXMLNamespaceLength+1 );
|
||||
aNamespaceName = rest.substr(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue