Skip to content

How to read XML in UTF-8 format?

2 messages · Manish Gupta, Rainer Hurling

#
How to read xml in UTF-8 format.  I have one XML file but i want to read it
in UTF-8 format. How this is possible? 

<barplot> 
            <cd> 
                <name>?</name> 
                <value1>3</value1> 
                <value2>2.9</value2> 
            </cd>   
            <cd> 
                <name>?</name> 
                <value1>3.3</value1> 
                <value2>3</value2> 
            </cd> 
            <cd> 
                <name>??</name> 
                <value1>2.3</value1> 
                <value2>2.9</value2> 
            </cd> 
            <cd> 
                <name>?</name> 
                <value1>3.4</value1> 
                <value2>2.6</value2> 
            </cd> 
            <cd> 
                <name>??</name> 
                <value1>3.1</value1> 
                <value2>2.4</value2> 
            </cd> 
</barplot> 

Regards



--
View this message in context: http://r.789695.n4.nabble.com/How-to-read-XML-in-UTF-8-format-tp4646232.html
Sent from the R help mailing list archive at Nabble.com.
#
On 15.10.2012 14:49 (UTC+2), Manish Gupta wrote:
Given, that the above lines are stored in an UTF-8 encoded file named
'xml-unicode', the following works for me:

library(XML)
xmlParseDoc("xml-unicode", encoding="UTF-8")

I think, there a smarter solutions.

Hope this helps,
Rainer