Skip to content

W3CDom.fromJsoup is loosing the original DocType #1183

@panthony

Description

@panthony

For my own case I did the following within W3CDom:

            Document out;
            if (in.childNodeSize() > 1 && in.childNode(0) instanceof org.jsoup.nodes.DocumentType) {
                final org.jsoup.nodes.DocumentType docType = (org.jsoup.nodes.DocumentType) in.childNode(0);

                final DOMImplementation impl = builder.getDOMImplementation();

                out = impl.createDocument(
                    null,
                    null,
                    impl.createDocumentType(
                        docType.attr("name"),
                        docType.attr("publicId"),
                        docType.attr("systemId")
                    ));

            } else {
                out = builder.newDocument();
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA confirmed bug, that we should fix

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions