Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to configure parser features ... (CDATA normalization on validation)

843834Aug 20 2004 — edited Aug 20 2004
Hi,

I had the problem, that the parser (Xerces, newest release) I use has a feature activated, that normalizes
values for attributes and elements. (see http://xml.apache.org/xerces2-j/features.html )

This feature is nice, but it seems that it also tries to normalize a CDATA section when XSD-validation is turned on. So whenever there is an element like
<musicgenre><![CDATA[R&B]]></musicgenre>
in an XML-file, the CDATA section causes an exception, because the normalization of "R&B" does not work. Note that normalization of "R & B" would work, but assume that I can't change the given xml.

Now I can turn off this feature by setting it via the setFeature(String,Boolean)-method to false,
but ain't there a way to configure such (default-set-to-true-) features by a properties file?

I know I can define the parser to use (JAXP properties etc.), but I can't define features that way?

Imaging you have some unmarshalling classes generated automatically by JAXB and you are not able to set this feature there, so there ain't a chance to do this?
Hard to image...

Any comments welcome

regards
Chris





Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 17 2004
Added on Aug 20 2004
1 comment
192 views