[R] XML and str

Ashley Ford ford at signal.QinetiQ.com
Wed Feb 7 18:18:56 CET 2007


If I read in an .xml file eg with 
> xeg <- xmlTreeParse(system.file("exampleData", "test.xml",
package="XML"))

It appears to be OK however examining it with str() gives an apparent
error

> str(xeg,2)
List of 2
 $ doc:List of 3
  ..$ file    : list()
  .. ..- attr(*, "class")= chr [1:2] "XMLComment" "XMLNode"
  ..$ version :List of 4
  .. ..- attr(*, "class")= chr "XMLNode"
  ..$ children:Error in obj$children[[...]] : subscript out of bounds

I am unsure if this is a feature or a bug and if the latter whether it
is in XML or str, it is not causing a problem but I would like to
understand what is happening, any ideas ?

examining components eg 
> str(xeg$doc$children,2)

List of 2
 $ comment: list()
  ..- attr(*, "class")= chr [1:2] "XMLComment" "XMLNode"
etc 

is OK.

XML Version 1.4-1, 
same behaviour on Windows and Linux, R version 2.4.1 (2006-12-18)




The information contained in this E-Mail and any subsequent
correspondence is private and is intended solely for the intended
recipient(s).  The information in this communication may be confidential
and/or legally privileged.  Nothing in this e-mail is intended to
conclude a contract on behalf of QinetiQ or make QinetiQ subject to any
other legally binding commitments, unless the e-mail contains an express
statement to the contrary or incorporates a formal Purchase Order.

For those other than the recipient any disclosure, copying,
distribution, or any action taken or omitted to be taken in reliance on
such information is prohibited and may be unlawful.

Emails and other electronic communication with QinetiQ may be monitored
and recorded for business purposes including security, audit and
archival purposes.  Any response to this email indicates consent to
this.

Telephone calls to QinetiQ may be monitored or recorded for quality
control, security and other business purposes.

QinetiQ Group plc,

Company Registration No: 4586941,  

Registered office: 85 Buckingham Gate, London SW1E 6PD



More information about the R-help mailing list