Displaying 20 results from an estimated 36 matches for "xmlroot".
Did you mean:
myroot
2004 Aug 12
1
Error Using pm.getabst()
R Users:
After installing Bioconductor, RSXML and all the relevant Win32 DLLs (libxml2, zlib, iconv), I receive the following error message when using pm.getabst()
Error in xmlRoot(absts) : no applicable method for "xmlRoot"
I receive this when using the example from help(pm.getabst).
Downloading the target XML file, parsing it with xmlTreeParse and applying xmlRoot returns no error.
Your thoughts/suggestions are appreciated.
Mark Larsen
2013 Jan 22
1
Create a Data Frame from an XML
...<row BRAND="FORD" NUM="1" YEAR="2007" VALUE="17500" />
<row BRAND="GMC" NUM="1" YEAR="2008" VALUE="22000" />
</data>
*R Code:*
doc< -xmlInternalTreeParse ("Sample2.xml")
top <- xmlRoot (doc)
xmlName (top)
names (top)
art <- top [["row"]]
art
**
*Output:*
> art<row BRAND="GMC" NUM="1" YEAR="1999" VALUE="10000"/>
* *
This is where I am having difficulties. I am unable to "access" additional
rows; ( i.e. &...
2010 Apr 06
1
GridR
...I selected GridR
package for the distributed programming.
*grid.init(service="local",debug=FALSE, localTmpDir="GridRTmp/")
grid.apply("x",UCS, wait=TRUE )*
UCS is a function.
When I execute this statement, I have some errors like :
*cannot load local function/variable: xmlRoot
extracted from line: : no visible global function definition for 'xmlRoot'
cannot load local function/variable: xmlTreeParse
extracted from line: : no visible global function definition for
'xmlTreeParse' *
In my function I have used the statement: *library("XML")*...
2003 Feb 25
1
How to modify XML documents and save changes
Dear,
I want to read XML documents, add child nodes to some elements and store
everything back as an XML document.
I've tryed the following:
doc <- xmlTreeParse("file.xml")
QTListNode<-xmlElementsByTagName(xmlRoot(doc)[[1]],"tagname")
append.xmlNode(QTListNode[[1]],newXMLNode(name ="Norm", attrs = NULL))
saveXML(doc, file = "out.xml", compression = 0, indent=T)
This doesn't seem to work.
Can anyone help?
Thanks,
Steffen
2012 May 17
1
using XML package to read RSS
...ue. The RSS feed I would like to
use is:
> URL <- "http://www.sec.gov/cgi-bin/browse-edgar?action=getcurrent&type=&company=&dateb=&owner=include&start=0&count=40&output=atom"
> library(XML)
> doc <- xmlTreeParse(URL)
> src <- xpathApply(xmlRoot(doc), "//entry")
I get an empty list rather than a list of each of the "entry":
> src
list()
attr(,"class")
[1] "XMLNodeSet"
I'm not sure how to fix this. Any suggestions? Do I need to provide
a namespace, or is the RSS malformed?
Thanks,
James
2005 Mar 11
3
XML to data frame or list
Dear useRs,
I have a simple/RTFM question about XML parsing. Given an XML file,
such as (fragment)
<A>100</A>
<B>23</B>
<C>true</C>
how do I import it in a data frame or list, so that the values (100,
23, true) can be accessed through the names A, B and C?
I installed the XML package and looked over the documentation...
however after 20 minutes and a couple of
2008 Apr 29
4
XML write?
Is there any function to write a XML structure, after it was
read using xmlTreeParse?
Ex:
library(XML)
x <- xmlTreeParse("Irpf2008/aplicacao/dados/12345678901/12345678901.xml")
# write it...
Alberto Monteiro
PS: please, brazilians, don't be offended by my foul language!
2013 Jan 22
2
Creating a Data Frame from an XML
...<row BRAND="FORD" NUM="1" YEAR="2007" VALUE="17500" />
<row BRAND="GMC" NUM="1" YEAR="2008" VALUE="22000" />
</data>
*R Code:*
doc< -xmlInternalTreeParse ("Sample2.xml")
top <- xmlRoot (doc)
xmlName (top)
names (top)
art <- top [["row"]]
art
**
*Output:*
> art<row BRAND="GMC" NUM="1" YEAR="1999" VALUE="10000"/>
This is where I am having difficulties. I am unable to "access" additional
rows; ( i.e. <...
2011 Jun 29
2
parse XML file
...011-04-05">8.8</v>
<v date="2011-04-06">13.5</v>
</stationname>
</data>
I would like to get a table in R like this:
stationname date value
Aachen 2011-04-01 14.1
Aachen 2011-04-01 17.6
.
.
.
Ahaus 2011-04-06 13.5
I tried to do this:
doc = xmlRoot(xmlTreeParse("de.dwd.klis.TADM.xml"))
tmp = xmlSApply(doc, function(x) xmlSApply(x, xmlValue))
but the stationname was not parsed because "Aachen" is kind of
attribute of stationname.
Could anyone give some help?
Thanks,
kai.
2009 Jan 23
1
XML package help
...lesList>
</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/[@eName='one']", xmlAttrs)
and it does not work.
Might somebody help me with the syntax here?
Thanks a lot!!
Aaron
[[alternative HTML version deleted]]
2011 Mar 30
1
Package XML: Parse Garmin *.tcx file problems
...reluctant to paste
even a shortened version.
The output below shows I can get nodes, but an attempt at value of a
single node comes up empty (even though there is data there.
One question: Has anybody succeeded parsing Garmin .tcx (xml) files?
Thanks!
Michael
_______________________
>doc2 = xmlRoot(xmlTreeParse("HR.reduced3.tcx",useInternalNodes = TRUE))
>xpathApply(doc2, "//*", xmlName)
[[1]]
[1] "TrainingCenterDatabase"
[[2]]
[1] "Activities"
[[3]]
[1] "Activity"
[[4]]
[1] "Id"
[[5]]
[1] "Lap"
[[6]]
[1] "Tota...
2011 Apr 06
1
Treatment of xml-stylesheet processing instructions in XML module
Hello again,
Another stumble here that is defeating me.
I try:
a<-readLines(url("http://feeds.feedburner.com/grokin"))
t<-XML::xmlTreeParse(a, ignoreBlanks=TRUE, replaceEntities=FALSE,
asText=TRUE)
elem<- XML::getNodeSet(XML::xmlRoot(t),"/rss/channel/item")[[1]]
And I get:
Start tag expected, '<' not found
Error: 1: Start tag expected, '<' not found
When I modify the second line in "a" to remove the following (just
leaving the <rss> tag with its attributes), I do not get the err...
2012 May 11
0
Using xpathapply or getnodeset to get text between two distinct tags
...t;-c('http://www.parl.gc.ca/housechamberbusiness/ChamberSittings.aspx?View=H&Language=E&Mode=1&Parl=41&Ses=1')
#Scrape the page with the links
doc<-scrape(url=hansard, parse=TRUE, follow=TRUE)
#Not sure what exactly this does, but it is necessary
doc<-doc[[1]]
#Get the xmlRoot directory
doc<- xmlRoot(doc)
#Get nodes that contain only the links to each day's transcripts
links<- getNodeSet(doc, "//a[@class='PublicationCalendarLink']/@href")
links<-matrix(links)
#Paste those href links to the root URL
links<-apply(links, 1, function(x) pa...
2011 Dec 06
1
Memory getting eaten up with XML
...doesn't free up the memory. When I monitor it in windows task manager the memory usage just climbs with each iteration until R crashes. I can replicate the problem with the small example:
file.name<-"C:\\MyData.xml.gz"
TEMPP<-xmlParse(file.name)
xx <- xmlRoot(TEMPP)
rm(xx)
rm(TEMPP)
gc()
Even though I remove the root node xx and the document TEMPP, the memory usage remains the same as it was when I first read it in... Any ideas/solutions?
I am using a 32bit version of R 2.14.0 on windows XP, and the latest version of XML (3.6.1)...
2009 Mar 02
2
Need help extracting info from XML file using XML package
...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 <- xmlValue(docroot[[52]][[3]][[7]][[3]][[3]][[1]][[1]])
but this is hardly general!
I'm hoping there is some relatively straightforward way to use
functions from the XML package to recursively descend the structure
and return the text strings representing the polygons in...
2010 Jun 22
0
XMLSchema:::processSchemaTypes() fails with XMLSchema.xsd [was: SSOAP fails with .types[[1]] : subscript out of bounds]
...//www.w3.org/2001/XMLSchema.xsd
> into genSOAPClientInterface() instead ?
Well, it's not possible, at least for me.
This is as far as I got, any help appreciated:
Thanks in advance,
yours,
Steffen
xsd = XMLSchema:::parseSchemaDoc("http://www.w3.org/2001/XMLSchema.xsd")
root = xmlRoot(xsd)
types = XMLSchema:::processSchemaTypes(root, root, verbose = TRUE)
traceback()
> xsd = XMLSchema:::parseSchemaDoc("http://www.w3.org/2001/XMLSchema.xsd")
> root = xmlRoot(xsd)
> types = XMLSchema:::processSchemaTypes(root, root, verbose = TRUE)
processing (sub) schema htt...
2013 Apr 12
1
Problem with handling of attributes in xmlToList in XML package
...tbios-ssn"
method="probed" conf="10"/></port>
</ports>
<times srtt="647" rttvar="71" to="100000"/>
</host>'
I want to store this as a list of lists, so I do:
mytree<-xmlTreeParse(mydoc)
myroot<-xmlRoot(mytree)
mylist<-xmlToList(myroot)
Now my problem is that when I want to fetch the attributes of the
services running of each port, the behavior is not consistent:
> mylist[["ports"]][[1]][["service"]]$.attrs["name"]
name
"msrpc"
> mylist[["...
2008 Dec 31
1
Chinese characters encoding problem with XML
XML is a good tool reading data from web within R. But I wonder how could get the encoding correctly.
library(XML)
url <- 'http://www.szitic.com/docc/jz-lmzq.html'
xml <- htmlTreeParse(url, useInternal=TRUE)
q <- "//tbody/tr/td"
dat <- unlist(xpathApply(xml, q, xmlValue))
df <- as.data.frame(t(matrix(dat, 4)))
dt<-as.character(df[15,1])
The first column of df
2005 May 10
0
Fwd: Extract just some fields from XML]
...s, including
>checking the name of the node to see if you want it
>and then storing it somewhere. That's where you'll
>need closures (simply viewed the "functions within functions" part) again,
>as in my example above.
>
>But here is a simple example
> doc = xmlRoot(xmlTreeParse(URL))
> xmlDOMApply(doc, function(node, ...)
> if(xmlName(node) == "PubDate")
> print(node)
> )
Gorjanc Gregor wrote:
> Hello!
>
> I am trying to get specific fields from an XML document and I am...
2005 May 08
2
Extract just some fields from XML
...cument and I am totally
puzzled. I hope someone can help me.
# URL
URL<-"http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=11877539,11822933,11871444&retmode=xml&rettype=citation"
# download a XML file
tmp <- xmlTreeParse(URL, isURL = TRUE)
tmp <- xmlRoot(tmp)
Now I want to extract only node 'pubdate' and its children, but I don't
know how to do that unless I try to dig into the structure of the XML
file. The problem is that structure can differ and then hardcoded set
of list indices i.e. tmp[[i]][[j]]... doesn't help me.
I've...