Skip to content

w3cDom.asString: Namespace for prefix 'xxx' has not been declared #2087

@richardmorleysmith

Description

@richardmorleysmith

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));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions