summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-02-26 15:55:17 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-02-27 09:09:54 +0100
commit61e4c00eee8c5d07a29cf7ec97bad653e3e8f8ce (patch)
tree0b1e7a824d52a655315e8bc22eccc8bd76031a75 /svtools
parent78233e47d07d89d656ef75b534272f71ea540572 (diff)
sw HTML import: allow custom XHTML namespace alias
This helps in case the HTML filter is given an XHTML that has an explicit namespace alias for <http://www.w3.org/1999/xhtml>. Change-Id: I437fa85ba19ce907c9c4b10c8d10aaf2217dc0ea Reviewed-on: https://gerrit.libreoffice.org/50380 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/svhtml/parhtml.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index c32b067ea905..be3167d30053 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -237,6 +237,12 @@ HTMLParser::~HTMLParser()
{
}
+void HTMLParser::SetNamespace(const OUString& rNamespace)
+{
+ // Convert namespace alias to a prefix.
+ maNamespace = rNamespace + ":";
+}
+
namespace
{
class RefGuard
@@ -1071,6 +1077,10 @@ HtmlTokenId HTMLParser::GetNextToken_()
// Search token in table:
sSaveToken = aToken;
aToken = aToken.toAsciiLowerCase();
+
+ if (!maNamespace.isEmpty() && aToken.startsWith(maNamespace))
+ aToken = aToken.copy(maNamespace.getLength());
+
if( HtmlTokenId::NONE == (nRet = GetHTMLToken( aToken )) )
// Unknown control
nRet = HtmlTokenId::UNKNOWNCONTROL_ON;