w3cDom.asString: Namespace for prefix 'xxx' has not been declared (original) (raw)

So basically I noticed this crash when trying to use w3CDom.asString() for a site which was created using Vue.js, and it was using "v-bind" in the place of "xxx"

To reproduce you can run the following test case:

@Test
void testNameSpaceCrash()
{
    final W3CDom w3CDom = new W3CDom().namespaceAware(false);
    final String html = """
        <html>
        <body>
        <div xxx:class="test"></div>
        </body>
        </html>""";
    final Document jSoupDoc = Jsoup.parse(html);
    final org.w3c.dom.Document w3CDoc = w3CDom.fromJsoup(jSoupDoc);

    assertDoesNotThrow(() -> w3CDom.asString(w3CDoc));
}