How do I map characters in element content of XMLSerializer?
843834Sep 25 2003 — edited Sep 25 2003Hello:
I am utilizing the XMLSerializer class as provided in the org.apache.xml.serialize package.
One of the things we would like to do with this class is restrict the textual content of the elements, modifying the original XML document/stream as follows:
Alphanumeric characters and some special characters can be passed 'as is'.
Some special characters need to be escaped to (permit valid XML).
All other characters need to be replaced with a single blank character.
I have implemented this inside of my own "basic" serializer (based on the examples provided in chapter 5 of "Java & XML", O'Reilly, Brett McLaughlin) inside of the Node.TEXT_NODE processor, but lose much of the desired functionality provided in the published class. Furthermore the text recommends utilizing the published class versus the examples given.
The home brewed methodology essentially checks each character against a case statement that remaps the incoming character to the appropriate output.
If anyone can provide any guidance on how to give the XMLValidator a valid list of characters (and having all others replaced by spaces) would be appreciated.
I'm just not sure which class/method does the actual 'work' of generating text inside of an element.
Brian Carpenter
brian.t.carpenter@lmco.com