styled-xml-parser/src/main/java/com/itextpdf/styledxmlparser/jsoup/safety/Cleaner.java
/**
     * Determines if the input document <b>body</b>is valid, against the safelist. It is considered valid if all the tags and attributes
     * in the input HTML are allowed by the safelist, and that there is no content in the <code>head</code>.
     * <p>
     * This method can be used as a validator for user input. An invalid document will still be cleaned successfully
     * using the {@link #clean(Document)} document. If using as a validator, it is recommended to still clean the document
     * to ensure enforced attributes are set correctly, and that the output is tidied.
     *
     * @param dirtyDocument document to test
     * @return true if no tags or attributes need to be removed; false if they do
     */
Determines if the input document bodyis valid, against the safelist. It is considered valid if all the tags and attributes
in the input HTML are allowed by the safelist, and that there is no content in the head.

This method can be used as a validator for user input. An invalid document will still be cleaned successfully
using the  #clean(Document) document. If using as a validator, it is recommended to still clean the document
to ensure enforced attributes are set correctly, and that the output is tidied.

@param dirtyDocument document to test
@return true if no tags or attributes need to be removed; false if they do
Determines if the input document bodyis valid against the safelist . It is considered valid if all the tags and attributes in the input HTML are allowed by the safelist and that there is no content in the head . This method can be used as a validator for user input . An invalid document will still be cleaned successfully using the #clean ( Document ) document . If using as a validator it is recommended to still clean the document to ensure enforced attributes are set correctly and that the output is tidied . @param dirtyDocument document to test @return true if no tags or attributes need to be removed ; false if they do
public boolean isValid(Document dirtyDocument) {
        Validate.notNull(dirtyDocument);
        Document clean = Document.createShell(dirtyDocument.baseUri());
        int numDiscarded = copySafeNodes(dirtyDocument.body(), clean.body());
        return numDiscarded == 0
            && dirtyDocument.head().childNodes().isEmpty(); 
    }
public boolean isValid ( Document dirtyDocument ) { Validate . notNull ( dirtyDocument ) ; Document clean = Document . createShell ( dirtyDocument . baseUri ( ) ) ; int numDiscarded = copySafeNodes ( dirtyDocument . body ( ) , clean . body ( ) ) ; return numDiscarded == 0 && dirtyDocument . head ( ) . childNodes ( ) . isEmpty ( ) ; }
Determines if the input document <b>body</b>is valid, against the safelist.
Determines if the input document <b > body< / b > is valid against the safelist .
// because we only look at the body, but we start from a shell, make sure there's nothing in the head