Java Mailing List Archive

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

[jdom-interest] Attribute vs text (fwd)

Bjorn Roche



Hey all,

I recent got an error report from my app in the field that read, in part:

org.jdom.IllegalDataException: The data "Celine Dion^@(protected)
attribute: 0x0 is not a legal XML character.

Yes, celine dion is an illegal character ;).

Seriously, though, I know I can't put binary data into an attribute, and I know
that's what JDOM is complaining about. What confuses me is that this data came
off an iTunes xml file that I read with JDOM. Of course, that field is user
editable, and I might have missed a check somewhere and let the user type in
something crazy, but assuming that's not the case, I have a few questions:

- Is it possible that some text is allowed in the text of an XML element, but
not in an attribute? I can easily restructure my xml document format to use the
content of an XML object for this info rather than attributes, but I need to
know if it will work.

- Is there an easy way to strip out illegal characters, so that I can wrap
calls like this up so that at least a best effort is made (at least in cases
where that makes sense)?

Thanks for an unbelievably awesome library!


Bjorn Roche

XO Wave
Audio Production and Post-Production Software for Mac OS X
To control your jdom-interest membership:
©2008 - Jax Systems, LLC, U.S.A.