[jdom-interest] Attribute vs text

Tatu Saloranta cowtowncoder at yahoo.com
Sat Sep 2 16:26:22 PDT 2006


--- "J. McConnell" <jdotmc at gmail.com> wrote:

> On 9/1/06, Tatu Saloranta <cowtowncoder at yahoo.com>
> wrote:
> > However, I think JDom is bit more lenient
> > than other tree models, like XOM, in that by
> default
> > you may be able to sneak in strings with illegal
> > characters.
> 
> Really?  I didn't realize this.  You said "by
> default" ... does that
> mean that there is a way to tell JDOM to be more
> strict?  Are there
> any reasons not to do this?

I must admit it has been a while since I looked at the
implementation, so I could be wrong, but I do think no
thorough checks are done beyond quoting text content
characters.
The main reason that is usually done is that it's
faster  and simpler to just take in whatever text is
passed than to check it against xml character validity
rules, assuming caller knows what it's doing (either
since supposedly text came from an xml parser, which
really should have validated character validity; or
because there's no point in adding nulls in there).

I think there is a way to add validation hooks, but
I'd need to look at sources to know where and how.

Also, I think part of the reason XOM was written to
add all such 'optional' checks, to try to make it
impossible to produce non-wellformed documents.

-+ Tatu +-


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the jdom-interest mailing list