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

The following examples show how to use org.jsoup.safety.Whitelist#relaxed() . 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
Source File: TRECAquaintDocumentIndexer.java    From lucene4ir with Apache License 2.0 6 votes vote down vote up
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
Source File: CommonCoreDocumentIndexer.java    From lucene4ir with Apache License 2.0 4 votes vote down vote up
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 File: RichText.java    From viritin with Apache License 2.0 4 votes vote down vote up
public Whitelist getWhitelist() {
    if (whitelist == null) {
        return Whitelist.relaxed();
    }
    return whitelist;
}
 
Example 4
Source File: RichText.java    From viritin with Apache License 2.0 4 votes vote down vote up
public Whitelist getWhitelist() {
    if (whitelist == null) {
        return Whitelist.relaxed();
    }
    return whitelist;
}