[jdom-interest] Finding syntactically-related children and parent Elements in XHTML

Bradley S. Huffman hip at a.cs.okstate.edu
Mon May 2 10:39:31 PDT 2005

Would implementing a custom org.jdom.filter.Filter and using
getDescendants(Filter) work?


"Costas Mantratzis" writes:

> Hello everyone.
> Just picking your brains on something you might have come across while
> playing with JDOM, JTidy or similar components...
> I'm trying to get my algorithm to understand which elements are
> syntactically directly related to their parents in an XHTML structure.
> For example, I want the system to know that all TD and TR elements are
> directly related to their TABLE parent (i.e. they can't exist without it)
> where as for example a P element within a TD is not "syntactically directly"
> related to its TD or TR or TABLE parents (i.e. a P can be found on its own
> within the XHTML document without always requiring TD to be its parent
> element).
> I was wondering if such a relation is easily detectable using something like
> JDOM, Jtidy etc.?
> I've been experimenting with getDescendants() and getChildren() methods but
> both of them return every child or descendant regardless of the direct
> syntactic relation it may have with its parents...
> Just wondering if you've ever come across such an issue or can think of a
possible solution...
> Been busting my head all day to try to find a "clean" way of doing this...
> C.
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list