Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

Re: [jdom-interest] Attribute vs text

Tatu Saloranta

2006-09-01

Replies:

--- Bjorn Roche <bjorn@(protected):

> 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
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.