Displaying 16 results from an estimated 16 matches for "xpathsapply".
Did you mean:
xpathapply
2009 Jan 23
1
XML package help
...<PatientCharacteristics eName="two" eValue="2"/>
<PatientCharacteristics eName="three" eValue="3"/>
</File>
</FilesList>
</Manifest>
I am attempting to use XML package and xpathSApply() to extract, say, the eValue attribute for eName=='0ne' for all <File> nodes that have <FileTypeId>==10. I try the following, amoung several things:
doc<-xmlInternalTreeParse(Manifest)
Root = xmlRoot(doc)
xpathSApply(Root, "//File[FileTypeId=10]/PatientCharacteristics...
2009 Dec 31
3
XML and RCurl: problem with encoding (htmlTreeParse)
...e below
> library(RCurl)
> library(XML)
>
> site <- getURL("http://www.aarresaari.net/jobboard/jobs.html")
> txt <- readLines(tc <- textConnection(site)); close(tc)
> txt <- htmlTreeParse(txt, error=function(...){}, useInternalNodes = TRUE)
>
> g <- xpathSApply(txt, "//p", function(x) xmlValue(x))
> head(grep(" ", g, value=T))
[1] "????PART-TIME EXPORT SALES ASSOCIATES (ALSO SUMMER WORK) ?
Valuatum Oy ??Helsinki ??Ilmoitus lis??tty: 31.12.2009. Viimeinen
hakup??iv??: 28.02.2010"
[2] "????MSN EDITOR / ONLINE PRODUCER...
2009 Jun 23
1
How to find b entries using xPath?
We got all rows by:
library(XML)
doc =
htmlParse('http://www.statcan.gc.ca/daily-quotidien/090520/t090520b1-eng.htm')
rows = xpathSApply(doc, '//table/tbody/tr')
The last row is:
row_last = rows[15]
row_last
[[1]]
<tr><td id="t1stub17" class="stub1 RGBShade"><b>Unsmoothed composite
leading indicator</b></td>
<td align="right" headers="hdt1r1c2 t1...
2009 Dec 03
3
Scraping a web page
I would like to be able to submit a list of URLs of various webpages and extract the "content" i.e. not the mark-up of those pages. I can find plenty of examples in the XML library of extracting links from pages but I cannot seem to find a way to extract the text. Any help would be greatly appreciated - I will not know the structure of the URLs I would submit in advance. Any
2012 Apr 12
3
Remove superscripts from HTML objects
Is there some way to remove superscripts from objects returned by
html/xmlParse (XML package)?
h <- "<html><p>Cat<sup>a</sup></p><p>Dog</p></html>"
doc <- htmlParse(h)
xpathSApply(doc, "//p", xmlValue)
[1] "Cata" "Dog"
I could probably remove the <sup> tags from the "h" object above, but I'd
rather just work with the results from htmlParse if possible (and not use
readLines to load raw HTML first).
Thanks,
Chris Stubben...
2010 Aug 01
0
ScrapeR Unanticipated XML objects
...or the quarterly income
statement (qtrinc) that I pulled from Google finance. I executed the
following commands after installing the scrapeR package.
require(scrapeR)
htmlfile<-scrape(url="http://www.google.com/finance?q=NASDAQ:MSFT&fstype=ii",headers=TRUE,parse=TRUE)
tables<-xpathSApply(htmlfile[[1]],"//table")
qtrinc<-tables[[1]]
xpathSApply(qtrinc,"//thead",xmlValue)
I receive the result:
[1] "\nIn Millions of USD (except for per share items)\n\n\n3 months
ending 2010-06-30\n\n\n3 months ending 2010-03-31\n\n\n3 months ending
2009-12-31\n\n\n3 mont...
2011 Oct 10
1
Text Mining with Facebook Reviews (XML and FQL)
...<- paste('SELECT review_id, message, rating from review where message
LIKE %',Qword,'%',sep='')
Facebook_url = paste('https://api.facebook.com/method/fql.query?query=
',QUERY,sep='')
mydata.xml <- xmlParseDoc(Facebook_url, asText=F)
mydata.vector <- xpathSApply(mydata.xml, '//s:entry/s:title', xmlValue,
namespaces =c('s'='http://www.w3.org/2005/Atom'))
The mydata.xml is NULL therefore no further step can be execute. I am not so
familiar with XML or FQL. Any suggestion will be appreciated. Thank you!
Best regards,
Kenneth
[[alte...
2010 Jul 03
1
XML and RCurl: problem with encoding (htmlTreeParse)
Hi All,
First method:-
>library(XML)
>theurl <- "http://home.sina.com"
>download.file(theurl, "tmp.html")
>txt <- readLines("tmp.html")
>txt <- htmlTreeParse(txt, error=function(...){}, useInternalNodes =
TRUE)
>g <- xpathSApply(txt, "//p", function(x) xmlValue(x))
>head(grep(" ", g, value=T))
[1] " | | ENGLISH" " "
[3] " ()" " "
[5] " " " ! ! !"
Sec...
2009 May 20
2
Example for parsing XML file?
Hi,
I am trying to parse XML files and read them into R as a data frame,
but have been unable to find examples which I could apply
successfully.
I'm afraid I don't know much about XML, which makes this all the more
difficult. If someone could point me in the right direction to a
resource (preferably with an example or two), it would be greatly
appreciated.
Here is a snippet from one of
2009 Mar 02
2
Need help extracting info from XML file using XML package
I have an XML file that has within it the coordinates of some
polygons that I would like to extract and use in R. The polygons are
nested rather deeply. For example, I found by trial and error that I
can extract the coordinates of one of them using functions from the
XML package:
doc <- xmlInternalTreeParse('doc.kml')
docroot <- xmlRoot(doc)
pgon <-
2010 Jan 10
1
xmlToDataFrame#Help!!!#follow-up
Dieter Menne pointed out that the (small) xml attachment didn't make it.
Here is an in-line version (see end of message). Let's hope it works
this time.
I'm struggling with interpreting XML files created by ADODB as
data.frames and I'm looking for advice.
Note:
This xlm contains a result set which comes from a rectangular data
array. I've been trying to play with
2017 Jul 10
0
Extract XMLAtrributeValue
...m not sure how to get "whQuestion" from that. The type of 'x' in extract
is "character"
[1] "XMLAttributeValue"
class
"whQuestion"
attr(,"class")
extract <- function(x){
print(x)
}
filteredclasses <-
function(){
classes <- xpathSApply(doc = posts, path = "/*/Posts/Post/@class", extract)
}
Thanks,
Mohan
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the send...
2018 May 23
0
Using R htmlParse() for manipulating URLs to access multiple pages
...by one. Hence, I am considering the base URL for parsing and to start from there onward.
baseurl <- htmlParse( "https://home.lala.com/bibi/blabla/",
encoding = "UTF-8")
xpath <- "//div[@id='Page']/strong[2]"
GetAllPages <- as.numeric(xpathSApply(baseurl, xpath, xmlValue))
Nevertheless, it does not work at all:
> GetAllPages
numeric(0)
Any hint?
[[alternative HTML version deleted]]
2008 Dec 17
1
Extract Data from a Webpage
Hi All:
I would like to extract the provider name, address, and phone number
from multiple webpages like this:
http://oasasapps.oasas.state.ny.us/portal/pls/portal/oasasrep.providersearch.take_to_rpt?P1=3489&P2=11490
Based on searching R-help archives, it seems like the XML package
might have something useful for this task. I can load the XML package
and supply the url as an argument to
2009 Sep 24
2
Downloading data from from internet
Hi all,
I want to download data from those two different sources, directly into R :
http://www.rateinflation.com/consumer-price-index/usa-cpi.php
http://eaindustry.nic.in/asp2/list_d.asp
First one is CPI of US and 2nd one is WPI of India. Can anyone please give
any clue how to download them directly into R. I want to make them zoo
object for further analysis.
Thanks,
--
View this message in
2013 Jan 22
2
Creating a Data Frame from an XML
Hello,
I'm attempting to read information from an XML into a data frame in R using
the "XML" package. I am unable to get the data into a data frame as I would
like. I have some sample code below.
*XML Code:*
Header...
Data I want in a data frame:
<data>
<row BRAND="GMC" NUM="1" YEAR="1999" VALUE="10000" />
<row