Package org.apache.abdera.filter

Examples of org.apache.abdera.filter.ListParseFilter


   
  }

  public void testWhiteListParseFilter() throws Exception {
   
    ListParseFilter filter = new WhiteListParseFilter();
    filter.add(Constants.FEED);
    filter.add(Constants.ENTRY);
    filter.add(Constants.TITLE);
    filter.add(Constants.ID);
    ParserOptions options = getParser().getDefaultParserOptions();
    options.setParseFilter(filter);
   
    URL url = FOMTest.class.getResource("/simple.xml");
    InputStream in = url.openStream();
View Full Code Here


    assertNull(entry.getSummaryType());
  }
 
  public void testBlackListParseFilter() throws Exception {
   
    ListParseFilter filter = new BlackListParseFilter();
    filter.add(Constants.UPDATED);
    ParserOptions options = getParser().getDefaultParserOptions();
    options.setParseFilter(filter);
   
    URL url = FOMTest.class.getResource("/simple.xml");
    InputStream in = url.openStream();
View Full Code Here

   
  }

  public void testWhiteListParseFilter() throws Exception {
   
    ListParseFilter filter = new WhiteListParseFilter();
    filter.add(Constants.FEED);
    filter.add(Constants.ENTRY);
    filter.add(Constants.TITLE);
    filter.add(Constants.ID);
    ParserOptions options = getParser().getDefaultParserOptions();
    options.setParseFilter(filter);
   
    URL url = FOMTest.class.getResource("/simple.xml");
    InputStream in = url.openStream();
View Full Code Here

    assertNull(entry.getSummaryType());
  }
 
  public void testBlackListParseFilter() throws Exception {
   
    ListParseFilter filter = new BlackListParseFilter();
    filter.add(Constants.UPDATED);
    ParserOptions options = getParser().getDefaultParserOptions();
    options.setParseFilter(filter);
   
    URL url = FOMTest.class.getResource("/simple.xml");
    InputStream in = url.openStream();
View Full Code Here

  }

  @Test
  public void testWhiteListParseFilter() throws Exception {
   
    ListParseFilter filter = new WhiteListParseFilter();
    filter.add(Constants.FEED);
    filter.add(Constants.ENTRY);
    filter.add(Constants.TITLE);
    filter.add(Constants.ID);
    ParserOptions options = getParser().getDefaultParserOptions();
    options.setParseFilter(filter);
   
    URL url = FOMTest.class.getResource("/simple.xml");
    InputStream in = url.openStream();
View Full Code Here

  }
 
  @Test
  public void testBlackListParseFilter() throws Exception {
   
    ListParseFilter filter = new BlackListParseFilter();
    filter.add(Constants.UPDATED);
    ParserOptions options = getParser().getDefaultParserOptions();
    options.setParseFilter(filter);
   
    URL url = FOMTest.class.getResource("/simple.xml");
    InputStream in = url.openStream();
View Full Code Here

  }

  @Test
  public void testWhiteListParseFilter() throws Exception {
   
    ListParseFilter filter = new WhiteListParseFilter();
    filter.add(Constants.FEED);
    filter.add(Constants.ENTRY);
    filter.add(Constants.TITLE);
    filter.add(Constants.ID);
    ParserOptions options = getParser().getDefaultParserOptions();
    options.setParseFilter(filter);
   
    URL url = FOMTest.class.getResource("/simple.xml");
    InputStream in = url.openStream();
View Full Code Here

  }
 
  @Test
  public void testBlackListParseFilter() throws Exception {
   
    ListParseFilter filter = new BlackListParseFilter();
    filter.add(Constants.UPDATED);
    ParserOptions options = getParser().getDefaultParserOptions();
    options.setParseFilter(filter);
   
    URL url = FOMTest.class.getResource("/simple.xml");
    InputStream in = url.openStream();
View Full Code Here

            return;
        }

        ParserOptions opts = parser.getDefaultParserOptions();

        ListParseFilter filter = new WhiteListParseFilter();
        filter.add(Constants.FEED);
        filter.add(Constants.ENTRY);
        filter.add(Constants.TITLE);
        opts.setParseFilter(filter);

        Document<Feed> doc;

        try {
View Full Code Here

   
    /**
     * By subclassing BlackListParseFilter, we can throw an error
     * when the parsed XML contains any content we don't want
     */
    ListParseFilter exceptionFilter = new BlackListParseFilter() {
      @Override
      public boolean acceptable(QName qname) {
        boolean answer = super.acceptable(qname);
        if (!(answer)) {
          throw new FOMException("Unacceptable element ::" + qname);
        }
        return answer;
      }

      @Override
      public boolean acceptable(QName qname, QName attribute) {
        return true;
      }
    };
    exceptionFilter.add(new QName("http://example.org", "a"));
   
    ParserOptions options = parser.getDefaultParserOptions();
    options.setParseFilter(exceptionFilter);
    Document<Feed> doc = parser.parse(
      UnacceptableElementsExample.class.getResourceAsStream("/xmlcontent.xml"),
View Full Code Here

TOP

Related Classes of org.apache.abdera.filter.ListParseFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.