[R] xmlAttrs and problems with reading node attributes of XML file (b ug?)

From: Tuszynski, Jaroslaw W. <JAROSLAW.W.TUSZYNSKI_at_saic.com>
Date: Sat 28 May 2005 - 00:14:57 EST


Consider the following code:

	  xmlFile = paste( "<?xml version=\"1.0\"
	            "<mzXML xmlns=\"a\" xmlns:xsi=\"b\"
	            "<parentFile a=\"a\" b=\"b\" />\n",
	  a = function(x,...){
	    cat("Attributes of ", xmlName(x), ": "); 
	  xmlTreeParse(file=xmlFile, asText=TRUE,
handlers=list("startElement"=a) )

And its output:

<?xml version="1.0" encoding="ISO-8859-1"?>
<mzXML xmlns="a" xmlns:xsi="b" xsi:schemaLocation="c">
<parentFile a="a" b="b" />

	Attributes of  parentFile :   a   b 
	                                     "a" "b" 

	Attributes of  mzXML : schemaLocation 

It seems to me that XML parser was able to correctly list all the attributes of the "parentFile" node but it failed on "mzXML" node. Am I missusing the functions somehow or is it a bug? Attribute names in "mzXML" node are part of mzXML file format and can not be changed (removing all ':' would fix the problem) and I would like to store than so whan I write mzXML file I have the same header.



 Jarek Tuszynski, PhD.                           o / \ 
 Science Applications International Corporation  <\__,|  
 (703) 676-4192                                   ">   \
 Jaroslaw.W.Tuszynski@saic.com                     `    \

	[[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat May 28 00:27:24 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:11 EST