Java Code Examples for org.jsoup.safety.Whitelist#relaxed()

The following examples show how to use org.jsoup.safety.Whitelist#relaxed() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public TRECAquaintDocumentIndexer(String indexPath, String tokenFilterFile, boolean positional){
    super(indexPath, tokenFilterFile, positional);

    try {
        whiteList = Whitelist.relaxed();
        whiteList.addTags("docno");
        whiteList.addTags("doc");
        whiteList.addTags("headline");
        whiteList.addTags("text");
        whiteList.addTags("date_time");
        whiteList.addTags("slug");
    } catch (Exception e){
        System.out.println(" caught a " + e.getClass() +
                "\n with message: " + e.getMessage());
    }

    doc = new Document();
    initFields();
    initAQUAINTDoc();
}
 
Example 2
private void initWhiteList()
{
    // Add White List Of The Document
    // The White List Are The Tags to keep in the Document after Reading From Jsoup
    try {
        // Add The popular tags in the white list
        whiteList = Whitelist.relaxed();

        // Add each allowed tag with its allowed attributes
        whiteList.addTags("title");

        // *******************

        whiteList.addTags("meta");
        whiteList.addAttributes("meta","name" , "content");

        // *******************

        whiteList.addTags("doc-id");
        whiteList.addAttributes("doc-id","id-string");

        // *******************

        whiteList.addTags("doc.copyright");
        whiteList.addAttributes("doc.copyright","year" , "holder");

        // *******************

        whiteList.addTags("classifier");
        whiteList.addAttributes("doc.copyright","year" , "holder");

        // *******************

        whiteList.addTags("pubdata");
        whiteList.addAttributes("pubdata","name");

        whiteList.addTags("hl1");

    } catch (Exception e){
        System.out.println(" caught a " + e.getClass() +
                "\n with message: " + e.getMessage());
    }
}
 
Example 3
Source Project: viritin   File: RichText.java    License: Apache License 2.0 4 votes vote down vote up
public Whitelist getWhitelist() {
    if (whitelist == null) {
        return Whitelist.relaxed();
    }
    return whitelist;
}
 
Example 4
Source Project: viritin   File: RichText.java    License: Apache License 2.0 4 votes vote down vote up
public Whitelist getWhitelist() {
    if (whitelist == null) {
        return Whitelist.relaxed();
    }
    return whitelist;
}