Menu

#206 Fix XHTML namespace normalisation for missing scheme

v2.30
open
nobody
None
5
2023-06-19
2018-07-16
No

The following cleanup in HtmlCleaner:

                    if (ns.equals("https://www.w3.org/1999/xhtml") || ns.equals("http://w3.org/1999/xhtml")){
                        ns = "http://www.w3.org/1999/xhtml";
                        Map<String, String> attributes = startTagToken.getAttributes();
                        attributes.put("xmlns", "http://www.w3.org/1999/xhtml");
                        startTagToken.setAttributes(attributes);
                    }

Should be replaced by:

                    if (ns.endsWith("//www.w3.org/1999/xhtml") || ns.endsWith("//w3.org/1999/xhtml")){
                        ns = "http://www.w3.org/1999/xhtml";
                        Map<String, String> attributes = startTagToken.getAttributes();
                        attributes.put("xmlns", ns);
                        startTagToken.setAttributes(attributes);
                    }

In order to:

  • handles case where scheme is not specified
  • DRY cleaned namespace name

Discussion

  • Scott Wilson

    Scott Wilson - 2019-09-04
    • Group: v 2.7 --> v2.24
     
  • Scott Wilson

    Scott Wilson - 2020-04-29
    • Group: v2.24 --> v2.25
     
  • Scott Wilson

    Scott Wilson - 2021-09-24
    • Group: v2.25 --> v2.26
     
  • Scott Wilson

    Scott Wilson - 2023-04-29
    • Group: v2.26 --> v2.29
     
  • Scott Wilson

    Scott Wilson - 2023-06-19
    • Group: v2.29 --> v2.30
     

Log in to post a comment.