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

Rolf Lear rlear at algorithmics.com
Mon May 2 09:40:05 PDT 2005

Use XHTML and investigate schemas....

That's what it's all about, those XML Schema things.

Try http://www.w3.org/TR/xhtml1/

Also, run your XHTML document through a validating parser.


-----Original Message-----
From: jdom-interest-bounces at jdom.org
[mailto:jdom-interest-bounces at jdom.org]On Behalf Of Costas Mantratzis
Sent: Monday, May 02, 2005 11:54 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Finding syntactically-related children and
parent Elements in XHTML

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

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...


To control your jdom-interest membership:

This email and any files transmitted with it are confidential and
proprietary to Algorithmics Incorporated and its affiliates
("Algorithmics").  If received in error, use is prohibited.  Please destroy,
and notify sender.  Sender does not waive confidentiality or privilege.
Internet communications cannot be guaranteed to be timely, secure, error or
virus-free.  Algorithmics does not accept liability for any errors or
omissions.  Any commitment intended to bind Algorithmics must be reduced to
writing and signed by an authorized signatory.

More information about the jdom-interest mailing list