283.6. 항목 필터링

위의 데이터 형식 섹션에 나와 있는 대로 XPath를 사용하여 항목을 필터링할 수 있습니다.You can filter out entries using XPath, as shown in the data format section above. 또한 Camel의 Bean Integration을 악용하여 고유한 조건을 구현할 수도 있습니다. 예를 들어, 위의 XPath 예제와 동등한 필터는 다음과 같습니다.

from<rss:file:src/test/data/rss20.xml?splitEntries=true&consumer.delay=100"). filter().method("myFilterBean", "titleContainsCamel").to("mock:result");

이를 위한 사용자 정의 빈은 다음과 같습니다.

public static class FilterBean {
       public boolean titleContainsCamel(@Body SyndFeed feed) {
           SyndEntry firstEntry = (SyndEntry) feed.getEntries().get(0);
return firstEntry.getTitle().contains("Camel");