22#include <com/sun/star/xml/sax/SAXException.hpp>
32 NamespaceMap::iterator
p;
33 OUString aNamespaceName(
aName );
36 constexpr char aXMLAttributeNamespace[] =
"xmlns";
37 if ( aNamespaceName.startsWith( aXMLAttributeNamespace ) )
39 constexpr sal_Int32 nXMLNamespaceLength = RTL_CONSTASCII_LENGTH(aXMLAttributeNamespace);
40 if ( aNamespaceName.getLength() == nXMLNamespaceLength )
42 aNamespaceName.clear();
44 else if ( aNamespaceName.getLength() >= nXMLNamespaceLength+2 )
46 aNamespaceName = aNamespaceName.copy( nXMLNamespaceLength+1 );
51 throw SAXException(
"A xml namespace without name is not allowed!", Reference< XInterface >(),
Any() );
55 if ( aValue.isEmpty() && !aNamespaceName.isEmpty() )
59 throw SAXException(
"Clearing xml namespace only allowed for default namespace!", Reference< XInterface >(),
Any() );
62 if ( aNamespaceName.isEmpty() )
90 throw SAXException(
"Attribute has no name only preceding namespace!", Reference< XInterface >(),
Any() );
93 return aAttributeName;
105 OUString aElementName =
aName;
112 if ( !aNamespace.isEmpty() )
114 aElementName = aNamespace +
"^";
124 throw SAXException(
"Attribute has no name only preceding namespace!", Reference< XInterface >(),
Any() );
129 aElementName +=
aName;
136 if ( aNamespace.isEmpty() )
144 throw SAXException(
"XML namespace used but not defined!", Reference< XInterface >(),
Any() );
void addNamespace(const OUString &aName, const OUString &aValue)
OUString applyNSToAttributeName(const OUString &) const
OUString const & getNamespaceValue(const OUString &aNamespace) const
OUString applyNSToElementName(const OUString &) const
NamespaceMap m_aNamespaceMap
OUString m_aDefaultNamespace