Sujoy,
I take it that what you want to know is how you can output
• when you marshal
your XmlObject.
XMLBeans has no difficulty parsing your document with
character references in it.
Well, in XMLBeans 2.1, you can output the bullet as a
character reference by making use of an
XmlOptionCharEscapeMap:
XmlOptionCharEscapeMap charEsc = new
XmlOptionCharEscapeMap();
charEsc.addMapping('\u2022',
XmlOptionCharEscapeMap.DECIMAL);
XmlOptions opts =
new XmlOptions();
opts.setSaveSubstituteCharacters(charEsc);
// then, with an XmlObject, doc, you
can call doc.xmlText(opts); etc.
Hope that
helps,
Wing
Yew
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, December 05, 2005 9:38 PM
To: [email protected]
Subject: How to parse a XML file containing special characters
Dear All,
In our application we use the StringBuffer to contain the XML as string. In some cases we need to save BULLETs, so in the StringBuffer we replace the BULLET with its UNICODE value, i.e. • and the content of the StringBuffer is written to an XML file. After saving the file, when we open the xml in a document editor, we see the • where we earlier placed it. Now when we are going to Parse the XML using XMLBean, the XMLObject we are getting , contains BULLET in the place of the UNICODE we provided. When we save the XMLObject to a file, it fails to write the UNICODE corresponding to BULLET. As a result when we open the same XML uisng any document editor we are getting some non-recognizable character in the places of BULLETS. How to preserve the UNICODE while parsing the file with XMLBeans?
Warm Regards,
Sujoy Banerjee
Tata Consultancy Services Limited
Plot B-1, Block EP & GP
Sector - V, Salt Lake Electronics Complex
Kolkata - 700 091,West Bengal
India
Mailto: [EMAIL PROTECTED]
Website: http://www.tcs.com
| Notice: The information contained in this e-mail
message and/or attachments to it may contain confidential or privileged
information. If you are not the intended recipient, any dissemination,
use, review, distribution, printing or copying of the information
contained in this e-mail message and/or attachments to it are strictly
prohibited. If you have received this communication in error, please
notify us by reply e-mail or telephone and immediately and permanently
delete the message and any attachments. Thank
you |

