Re: [R] is there a Decode HTML function somewhere (similar to URLdecode)?

From: Tony Breyal <tony.breyal_at_googlemail.com>
Date: Thu, 24 Jun 2010 15:49:07 +0100

Thank you kindly Henrique, that works perfectly for me.

On 24 June 2010 15:25, Henrique Dallazuanna <wwwhsd_at_gmail.com> wrote:
> Try this:
>
> library(XML)
> xmlValue(getNodeSet(htmlParse(x, asText = TRUE), "//p")[[1]])
>
> On Thu, Jun 24, 2010 at 6:53 AM, Tony Breyal <tony.breyal_at_googlemail.com>
> wrote:
>>
>> (I've just realised that the example above might not be clear when
>> viewed in a browser)
>>
>> So just to clarify, I would like to convert HTML entities into the
>> ASCII equivalent using R, saving the results to a plain text file.
>>
>> For example:
>>
>> x <- paste("i", "s", "n", "&", "a", "p", "o", "s", ";", "t", sep = "")
>>
>> would become the following, when output to the plain text file:
>>
>> > "isn't"
>>
>>
>> Thank you again for your time,
>> Tony Breyal
>>
>> On 23 June 2010 12:32, Tony B <tony.breyal_at_googlemail.com> wrote:
>> > Dear all,
>> >
>> > I am aware of the URLdecode(..) function and was wondering if there
>> > was something similar for HTML?
>> >
>> > For example, I would like to convert strings like this:
>> >
>> >> x <- "isn&apos;t"
>> >
>> > into this:
>> >
>> >> "isn't"
>> >
>> > Many thanks for your time,
>> > Tony Breyal
>> >
>> > # O/S: Windows Vista 32 bit
>> > # R version 2.11.0 (2010-04-22)
>>
>>
>>
>> --
>> Tony Breyal
>>
>> ______________________________________________
>> R-help_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>

-- 
Tony Breyal

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 24 Jun 2010 - 15:03:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Jun 2010 - 15:20:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive