[jdom-interest] Attribute vs text

Tatu Saloranta cowtowncoder at yahoo.com
Fri Sep 1 16:28:27 PDT 2006


--- Bjorn Roche <bjorn at xowave.com> wrote:

> On Fri, 1 Sep 2006, Jason Hunter wrote:
> 
...
> I see that I can use the verifier class, which I had
> not noticed before 
> (d'oh!), to check the validity of strings. Am I
> right to assume that both 
> attributes and content may have the same data? In
> other words, if a string 
> is valid content is it also valid attribute value,
> nd vise versa?

Yes, in that characters like 0x0 are illegal in XML,
everywhere, including text, attribute values, comments
and even processing instructions.

Also note that rules for detecting such illegal
characters are different depending on whether you are
parsing an external document (from file, network), or
building a document using JDom. In former case it's
not JDom that verifies legality of characters, but the
underlying parser (SAX etc); in latter case it should
be JDom. 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.

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