Hi Kristen,
The in-memory representation of the text after XMLBeans parsing is with all entities decoded, when you save it back XMLBeans has to use CDATA or encoded entities to have a well formed xml representation. By default XMLBeans uses an algorithm to minimize the length of the message, but you can control the use of CDATA see this wiki page for details: http://wiki.apache.org/xmlbeans/CdataOptions Cezar _____ From: Kristen Roth [mailto:[email protected]] Sent: Thursday, September 03, 2009 3:12 PM To: [email protected] Subject: xml parsing issue, xmlbeans version 2.4 Hi - I am using xmlbeans to parse a chunk of xml. Some of the fields may contain encoded html. Sometimes in the parsing process, the html gets decoded and the value of the field gets wrapped in cdata (which is exactly what I want). For instance: Field before parsing: <text><p> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p><p> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p><p> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p></text> Field after parsing: <sch:text><![CDATA[<p> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p><p> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p><p> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p>]]></sch:text> However, sometimes this does not happen - for instance: Field before parsing: <text><p> >Some sample data here</p></text> Field after parsing <sch:text><p>Some sample data here</p></sch:text> I'm using the following XmlOptions: XmlOptions opts = new XmlOptions(); Map<String, String> ns = new HashMap<String, String>(); ns.put("", "http://www.mynamespace.com/"); opts.setLoadSubstituteNamespaces(ns); contentDetailXml = ContentDetailXmlDocument.Factory.parse( contentDetail, opts); Any ideas as to what might be going on here? I've tried using setLoadUseDefaultResolver with no luck. Thanks in advance for any help! Kristen The information contained in this email and any attachments may be private and is the confidential property of Molecular and its affiliates. If you are not the intended recipient(s) or have otherwise received this email unlawfully or in error, please delete this email and inform the sender as soon as possible. This email may not be disclosed, stored, used, published or copied by anyone other than the intended recipient(s).

