[jdom-interest] Filters Contribution

Teemu Tingander Teemu.Tingander at tecnomen.fi
Fri May 3 00:21:48 PDT 2002


Hi!

I have made a set of filters that can be used with
Element.getContent(Filter f).
This could be my small contibution for JDOM work : )
So Is there anyone who could  give me some ideas  who to address to make it
possible to share these with you !.
Comments and ideas for new fileters are also welcome!

The Filter Include
	And- , Or-, and Not- filtes , Attribute filter , Content Filter and
ListedElementFilter ( not so many :( ), but quite useful thought!

	And it makes it possible to do queries like .. ( of course you can
use XPATH too :) )

	QUERY 1.
	Select all children that are <node>  elements and not having mode
-attribute "twisted"..

	AndFilter filter =
		new AndFilter(new ElementFilter("node"), 
				   new NotFilter(new AttributeFilter("mode",
"twisted")));

	QUERY 2.
	Select all menus that have attribute scope "public" or they contain
node elements that have attribute scope "public"..

	AndFilter filter = new AndFilter(
						new ElementFilter("node"),
						new OrFilter( 
							new
AttributeFilter("scope", "public"),
							new ContentFilter(
								new
AndFilter(
									new
ElementFilter("node"),
									new
AttributeFilter("scope", "public")
								)	
							)
						)
					}
	- HUH :)

	QUERY 3.

	Select all element whose names are "a","b" or"c""..

	ListedElementFilter filter = new ListedElementFilter(new
String[]{"a","b","c"});

	Easy .. :)

So does anyone see any 	idea in here :) let me know!

Sorry for Bad English :)

- Teemu




More information about the jdom-interest mailing list