Skip to content

Commit

Permalink
trim namespace prefix (issue #114)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Jun 3, 2024
1 parent fe824e4 commit 4c05df5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,18 @@ public Element createElementNS(final String namespaceURI, final String qualified
@Override
public Element createElementNS(final String namespaceURI, final String qualifiedname) {
if (namespaceURI == null
|| namespaceURI.length() == 0
|| NamespaceBinder.XHTML_1_0_URI.equals(namespaceURI)) {
|| namespaceURI.length() == 0) {
return createElement(qualifiedname);
}

if (NamespaceBinder.XHTML_1_0_URI.equals(namespaceURI)) {
final int index = qualifiedname.indexOf(':');
if (index != -1) {
return createElement(qualifiedname.substring(index + 1));
}
return createElement(qualifiedname);
}

return super.createElementNS(namespaceURI, qualifiedname);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(HTML
(HEAD
)HEAD
(H:BODY
(BODY
A{http://www.w3.org/2000/xmlns/}xmlns:h http://www.w3.org/1999/xhtml
)H:BODY
)BODY
)HTML

0 comments on commit 4c05df5

Please sign in to comment.