[R] question about XML (package)

Ott Toomet otoomet at econ.dk
Fri Feb 21 10:22:04 CET 2003


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 fields v1, v2 and v3 which differ only by spacing.
Now when reading it as

> a <- xmlTreeParse("/home/otoomet/tyyq/Taani-piir/andmed/test.xml")
> a$doc$children$fields
 <fields>
  <v1>
  </v1>
  <v2>
  2
  </v2>
  <v3>
  3
  </v3>
 </fields>

you can see that field v1 is empty.  Is it my misinterpretation, or a
problem with the library?

Thanks in advance,

Ott

-----------------
> version
         _                
platform i686-pc-linux-gnu
arch     i686             
os       linux-gnu        
system   i686, linux-gnu  
status                    
major    1                
minor    5.1              
year     2002             
month    06               
day      17               
language R                
------------
Package: XML
Version: 0.93-1
Date: 2002/11/06




More information about the R-help mailing list