Skip to content

Namespaces are removed in 1.18.2 #2236

Closed
@JaneHuang1234

Description

@JaneHuang1234

Hi,

We recently upgraded from 1.18.1 to 1.18.2 and namespaces in xml are removed during parse.

Document doc = Jsoup.parse(new ByteArrayInputStream("<?xml version=\"1.0\" encoding=\"UTF-8\"?><test1><test xmlns:p1=\"test-namespace\"> </test></test1>".getBytes("UTF-8")),
        "UTF-8", "", Parser.xmlParser());
    doc.outputSettings().charset("UTF-8");
    doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml);
    System.out.println(doc.toString());

The result was

<?xml version="1.0" encoding="UTF-8"?><test1><test xmlns:p1="test-namespace">&#xa0;</test></test1>

in 1.18.1

But with 1.18.2:

<?xml version="1.0" encoding="UTF-8"?><test1><test>&#xa0;</test></test1>

Is there any configuration to keep the namespaces?

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis is a duplicate issue or root-cause of another issuefixedAn {bug|improvement} that has been {fixed|implemented}

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions