Prevent REXML from doing any character decoding

H

helzer

How can I ask REXML to NOT DO any sort of character decoding or
encoding when it processes XML files?
My files include all sorts of encoding, which is unfortunately not
recognized by REXML. I just want to process it so that all characters
are maintained exactly as they are.

For example, Unicode HTML encoded characters (like  ) should just
stay this sequence, and not transformed into Â.

It it possible?
Can I do this without adding a character encoding line to the XML
files?

Thanks,
Helzer
 
J

Jano Svitok

How can I ask REXML to NOT DO any sort of character decoding or
encoding when it processes XML files?
My files include all sorts of encoding, which is unfortunately not
recognized by REXML. I just want to process it so that all characters
are maintained exactly as they are.

For example, Unicode HTML encoded characters (like  ) should just
stay this sequence, and not transformed into =C2.

It it possible?
Can I do this without adding a character encoding line to the XML
files?

Thanks,
Helzer

http://www.germane-software.com/software/rexml/docs/tutorial.html :

There is a programmatic solution: :raw. If you set the :raw flag on
any Text or Element node, the entities within that node will not be
processed. This means that you'll have to deal with entities yourself:

Entity Replacement

doc =3D Document.new('<!DOCTYPE
foo [ <!ENTITY ent "replace"> ]><a>replace
&ent;</a>',{:raw=3D>:all})
doc.root.text #-> "replace &ent;" doc.to_s # Generates: #
<!DOCTYPE foo [ # <!ENTITY ent "replace"> #
]><a>replace &ent;</a>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top