[jdom-interest] Attribute vs text (fwd)

Bjorn Roche bjorn at xowave.com
Fri Sep 1 09:23:28 PDT 2006


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^@" is not legal for a JDOM 
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

-------------
Bjorn Roche

XO Wave
Audio Production and Post-Production Software for Mac OS X
http://www.xowave.com
http://www.myspace.com/xowave
http://blog.bjornroche.com


More information about the jdom-interest mailing list