search for: xmltreeparse

Displaying 20 results from an estimated 59 matches for "xmltreeparse".

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!
2010 Aug 30
4
getNodeSet - what am I doing wrong?
Hi, Why is the following retuning a nodset of length 0: > library(XML) > test <- xmlTreeParse( > "http://www.unimod.org/xml/unimod_tables.xml",useInternalNodes=TRUE) > getNodeSet(test,"//modifications_row") Thanks for any hint. Joh
2005 May 02
2
"Special" characters in URI
...mp$term <- "gorjanc g[au]" R> tmp$URL <- "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?term=gorjanc g[au]" R> tmp $term [1] "gorjanc g[au]" $URL [1] "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?term=gorjanc g[au]" R> xmlTreeParse(tmp$URL, isURL=TRUE, handlers=NULL, asTree=TRUE) Error in xmlTreeParse(tmp$URL, isURL = TRUE, handlers = NULL, asTree = TRUE) : error in creating parser for http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?term=gorjanc g[au] # so I have a problem with space and [ and ] # let'...
2003 Feb 21
1
question about XML (package)
Hi, I have a problem with spacing in XML files when reading them with xmlTreeParse. I don't know the exact specification of xml but according what I have red before it should work. consider a tiny test.xml file: <?xml version="1.0"?> <fields> <v1>1 </v1> <v2> 2 </v2> <v3> 3</v3> </fields> i.e. I have three fi...
2011 Jul 05
2
Stuck ...can't get sapply and xmlTreeParse working
...he function hm; comments show the line in question. The function hm is called by sapply and is at the bottom of the code. Other stuff above line 24 works correctly including the first couple of lines of the function hm. Should I be using a different apply function or am I doing something wrong with xmlTreeParse ? library(XML) url.montco <- "http://webapp.montcopa.org/sherreal/salelist.asp?saledate=07/27/2011" tbl <-data.frame(readHTMLTable(url.montco))[, c(3,5,6,8,9)] tbl <-tbl[2: length(tbl[,1]),] names(tbl) <- c("Address", "Township", "Parcel", &quo...
2008 Jun 17
2
try catch block
How can I use the try catch block such that if this statement fails xml <- xmlTreeParse(xmlTxt, useInternal=TRUE) then this statement is executed xml <- xmlMalFormed() ? This code does not work but assuming its somewhere along these lines: tryCatch(xml <- xmlTreeParse(xmlTxt, useInternal=TRUE), xml <- xmlMalFormed(f1)) -- View this message in context: http://www.nabbl...
2007 Feb 24
3
gsub: replacing a.*a if no occurence of b in .*
I am trying to read a number of XML files using xmlTreeParse(). Unfortunately, some of them are malformed in a way that makes R crash. The problem is that closing tags are sometimes repeated like this: <tag>value1</tag><tag>value2</tag>some garbage</tag></tag><tag>value3</tag> I want to preprocess the content...
2011 Jun 07
1
XML segfault on some architectures
Hi, I found an architecture-specific segfault problem with the XML package. I originally found the problem using the parseKGML2Graph function in the Bioconductor KEGGgraph package, but as far as I can tell the underlying issue seems to be with the xmlTreeParse which is called by parseKGML2Graph. I'm trying this piece of code, from the xmlTreeParse help page: library(XML) fileName <- system.file("exampleData", "test.xml", package="XML") x <- xmlTreeParse(fileName) On my Mac and on nodes of one of the linux cluste...
2011 Apr 06
0
Curious treatment of entities in xmlTreeParse
...ge"> AFAIK, this is a correct encoding, Parsing this with the following two lines followed by inspecting "t" shows that the &#38; references have been translated to "&" while other entity refs have not. a<-readLines(url(as.character(feeds[2,2]))) t<-XML::xmlTreeParse(a, replaceEntities=FALSE, asText=TRUE) I'm guessing this is what breaks things when I try to do things with tm: rss2Reader <- readXML( spec = list( Author = list("node", "/item/creator"), Content = list("node", "/item/description"), DateTimeS...
2004 Sep 29
2
RSXML - Parsing XML Documents on Internet
R Users - I asked about this a few months ago and never did quite figure it out, so with more information, allow me to try again. If I use the following code: library(xml) xmlTreeParse("http://home.comcast.net/~larsenmtl/xmlTestDoc.xml", isURL = TRUE) I receive this error: Error in xmlTreeParse("http://home.comcast.net/~larsenmtl/xmlTestDoc.xml"", : error in creating parser for http://home.comcast.net/~larsenmtl/xmlTestDoc.xml" Now I kno...
2007 Sep 01
2
Importing huge XML-Files
Dear all, for my diploma thesis I have to import huge XML-Files into R for statistical processing - huge means a size about 33 MB. I'm using the XML-Package version 1.9 As far as reading the complete file into R via xmlTreeParse doesn't work or is too slow, I'm trying to use xmlEventParse but I got completely stuck. I have many different type of nodes + <configuration> - <Data> - <dataSets noOfDataSets="50000"> - <dataSet number="1"> - <measurements>...
2007 Dec 14
6
Analyzing Publications from Pubmed via XML
...would like to track in which journals articles about a particular disease are being published. Creating a pubmed search is trivial. The search provides data but obviously not as an R dataframe. I can get the search to export the data as an xml feed and the xml package seems to be able to read it. xmlTreeParse(" http://eutils.ncbi.nlm.nih.gov/entrez/eutils/erss.cgi?rss_guid=0_JYbpsax0ZAAPnOd7nFAX-29fXDpTk5t8M4hx9ytT- ",isURL=TRUE) But getting from there to a dataframe in which one column would be the name of the journal and another column would be the year (to keep things simple) seems to be b...
2010 Apr 06
1
GridR
...Tmp/") 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")* Can you give me suggestion Thanks in advance Wesley C Mathew [[alternative HTML version deleted]]
2013 Apr 12
1
Problem with handling of attributes in xmlToList in XML package
...;/><service name="netbios-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...
2009 Sep 03
1
encoding problem using xml package
...ITEM> </Daten> The following code shows that i cannot extract the Value of "Länge" correctly. Any help is very welcom. ---------------------------------------- Code Start ------------ > fname1 <- "test1.xml" > fname2 <- "test2.xml" > doc <- xmlTreeParse(fname1,useInternalNodes=T) > show(doc) <?xml version="1.0" encoding="ISO-8859-1"?> <Daten> <ITEM> <Messdaten> <MESSUNG> <BEZEICHNUNG>Länge</BEZEICHNUNG> </MESSUNG> </Messdaten> </ITEM>...
2005 May 10
0
Fwd: Extract just some fields from XML]
...on(node, ...) { > > if(xmlName(node) %in% elementNames) > els[[length(els) + 1]] <<- node > > node > } > > list(startElement = startElement, els = function() els) >} > >So you can use it as > > myHandlers = getElements("PubDate") > xmlTreeParse(URL, handlers = myHandlers) > >And then > myHandlers$els() > >returns a list of the the three PubDate elements in the document. > >If you wanted both PubDate and PubMedPubDate elements, >you could use > > myHandlers = getElements(c("PubDate", "PubMedPu...
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 he...
2007 May 14
1
XML parsing under R / Extracting nodes’ values
...lt;nbRuns>5</nbRuns> <nbStep>2000</nbStep> (?) ===End file=== I need to extract those values and to make them R variables such as: nbRelations = 2 nbActors = 2 nbRuns = 5 nbSteps = 2000 I read the help and have seen the examples of the xml package, it seems that I need to use xmlTreeParse() function but I don't know how exactly as I'm not an R advanced programmer, please can anyone show me how to do that explicitly ? Any help would be much appreciated Thanks, Abdel University of Boumerd?s Algeria
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...
2012 May 17
1
using XML package to read RSS
...n I try to use another RSS feed I have an issue. 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, o...