Hello again, Following my previous email, after reviewing my other code I found that XmlBeans write any values containing "&" as a CDATA block, this is causing problem for me too. Using & instead wouldn't help.
Is there anyway can I set Xmlbeans not to automatically write values as CDATA, and is there anyway can I set it to write values as CDATA when I need to? Thanks very much for your help! Bing On Fri, Sep 12, 2008 at 11:16 AM, Bing Qiao <[EMAIL PROTECTED]> wrote: > Hello, > > I just started using XmlBeans and have been troubled with the use of > CDATA since the beginning. > > I'm using version 2.4. The problem is, some elements are read or saved > automatically as CDATA while others simply won't come out as CDATA no > matter what I do. > I read a few previous posts here and tried what mentioned in them but > it didn't work. > > The document is created by: > > XmlOptions opts = new XmlOptions(); > opts.setUseCDataBookmarks(); > reportDocument = ReportDocument.Factory.newInstance(opts); > > Then the field is created by: > FieldsType fields = FieldsType.Factory.newInstance(); > FieldType field = fields.addNewField(); > field.setName(column.getClsName()); > field.addDataField("<br>"); > XmlCursor c = field.xgetDataFieldArray(0).newCursor(); > c.toFirstContentToken(); > c.setBookmark(CDataBookmark.CDATA_BOOKMARK); > > reportDocument.toString() returns the xml: > ... > <Fields> > <Field Name="Account_Currency"> > <DataField><br></DataField> > </Field> > </Fields> > ... > > I need the DataField content to be CDATA. As shown above, I tried > using CDATA_BOOKMARK, but it just doesn't work. > > Any help please thanks very much! > > Bing > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]