Re: [R] Parsing a XML file

2010-08-27 Thread Orvalho Augusto
Ok.

Pardon me. Its is not a bug. My XML is malformed. The program that generates
writes things like:
agecat5yr/agecat

Which make the XML unsable.

Sorry everyone

Caveman


On Wed, Aug 25, 2010 at 5:31 AM, Duncan Temple Lang dun...@wald.ucdavis.edu
 wrote:


 xmlDoc() is not the function to use to parse a file.

 Use

   doc = xmlParse(Malaria_Grave.xml)


 xmlDoc() is for programmatically creating a new XML within R.
 It could be more robust to being called with a string, but
 the key thing here is that it is not the appropriate function for what
 you want.


 Also, if there had been a problem with the parsing, you'd need to give
 me/us the offending XML  file so that we could have a chance of reproducing
 the problem.

   D.


 On 8/24/10 2:35 PM, Orvalho Augusto wrote:
  I have one XML file with 30MB that I need to read the data.
 
  I try this;
  library(XML)
  doc - xmlDoc(Malaria_Grave.xml)
 
  And R answers like this
   *** caught segfault ***
  address 0x5, cause 'memory not mapped'
 
  Traceback:
   1: .Call(RS_XML_createDocFromNode, node, PACKAGE = XML)
   2: xmlDoc(Malaria_Grave.xml)
 
  Possible actions:
  1: abort (with core dump, if enabled)
  2: normal R exit
  3: exit R without saving workspace
  4: exit R saving workspace
 
 
  Or I try this:
  doc - xmlTreeParse(Malaria_Grave.xml)
 
  I get this
  xmlParseEntityRef: no name
  xmlParseEntityRef: no name
  Error: 1: xmlParseEntityRef: no name
  2: xmlParseEntityRef: no name
 
  Please guys help this simple mortal!
  Caveman
 
[[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Parsing a XML file

2010-08-24 Thread Orvalho Augusto
I have one XML file with 30MB that I need to read the data.

I try this;
library(XML)
doc - xmlDoc(Malaria_Grave.xml)

And R answers like this
 *** caught segfault ***
address 0x5, cause 'memory not mapped'

Traceback:
 1: .Call(RS_XML_createDocFromNode, node, PACKAGE = XML)
 2: xmlDoc(Malaria_Grave.xml)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace


Or I try this:
doc - xmlTreeParse(Malaria_Grave.xml)

I get this
xmlParseEntityRef: no name
xmlParseEntityRef: no name
Error: 1: xmlParseEntityRef: no name
2: xmlParseEntityRef: no name

Please guys help this simple mortal!
Caveman

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Parsing a XML file

2010-08-24 Thread Gavin Simpson
On Tue, 2010-08-24 at 23:35 +0200, Orvalho Augusto wrote:
 I have one XML file with 30MB that I need to read the data.
 
 I try this;
 library(XML)
 doc - xmlDoc(Malaria_Grave.xml)
 
 And R answers like this
  *** caught segfault ***
 address 0x5, cause 'memory not mapped'

This is most likely a bug in your version (unstated) of the XML package.
But it may be a problem with the file, though XML shouldn't crash R.
Make sure you are using the latest version of the XML package and R is
up-to-date, then retry your code in a new R session. If it still
segfaults, you need to file a bug report with the maintainer: Duncan
Temple Lang, and include all the relevant details such as output from

sessionInfo()

The .xml file you are trying to read and the code required to reproduce
the segfault.

HTH

G

 Traceback:
  1: .Call(RS_XML_createDocFromNode, node, PACKAGE = XML)
  2: xmlDoc(Malaria_Grave.xml)
 
 Possible actions:
 1: abort (with core dump, if enabled)
 2: normal R exit
 3: exit R without saving workspace
 4: exit R saving workspace
 
 
 Or I try this:
 doc - xmlTreeParse(Malaria_Grave.xml)
 
 I get this
 xmlParseEntityRef: no name
 xmlParseEntityRef: no name
 Error: 1: xmlParseEntityRef: no name
 2: xmlParseEntityRef: no name
 
 Please guys help this simple mortal!
 Caveman
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Parsing a XML file

2010-08-24 Thread Orvalho Augusto
It seems to be a bug on the XML package.

This is what I run (and it is not the only file):
 library(XML)
 doc - xmlDoc(Malaria_Grave.xml)

 *** caught segfault ***
address 0x9, cause 'memory not mapped'

Traceback:
 1: .Call(RS_XML_createDocFromNode, node, PACKAGE = XML)
 2: xmlDoc(Malaria_Grave.xml)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 1
aborting ...
Segmentation fault

##=
 sessionInfo()
R version 2.11.1 (2010-05-31)
i686-pc-linux-gnu

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C  LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] XML_3.1-1


##=

Thanks
Caveman


On Wed, Aug 25, 2010 at 12:02 AM, Gavin Simpson gavin.simp...@ucl.ac.ukwrote:

 On Tue, 2010-08-24 at 23:35 +0200, Orvalho Augusto wrote:
  I have one XML file with 30MB that I need to read the data.
 
  I try this;
  library(XML)
  doc - xmlDoc(Malaria_Grave.xml)
 
  And R answers like this
   *** caught segfault ***
  address 0x5, cause 'memory not mapped'

 This is most likely a bug in your version (unstated) of the XML package.
 But it may be a problem with the file, though XML shouldn't crash R.
 Make sure you are using the latest version of the XML package and R is
 up-to-date, then retry your code in a new R session. If it still
 segfaults, you need to file a bug report with the maintainer: Duncan
 Temple Lang, and include all the relevant details such as output from

 sessionInfo()

 The .xml file you are trying to read and the code required to reproduce
 the segfault.

 HTH

 G

  Traceback:
   1: .Call(RS_XML_createDocFromNode, node, PACKAGE = XML)
   2: xmlDoc(Malaria_Grave.xml)
 
  Possible actions:
  1: abort (with core dump, if enabled)
  2: normal R exit
  3: exit R without saving workspace
  4: exit R saving workspace
 
 
  Or I try this:
  doc - xmlTreeParse(Malaria_Grave.xml)
 
  I get this
  xmlParseEntityRef: no name
  xmlParseEntityRef: no name
  Error: 1: xmlParseEntityRef: no name
  2: xmlParseEntityRef: no name
 
  Please guys help this simple mortal!
  Caveman
 
[[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

 --
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
  Dr. Gavin Simpson [t] +44 (0)20 7679 0522
  ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
  Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
  Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
  UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Parsing a XML file

2010-08-24 Thread Orvalho Augusto
My system is an Ubuntu 9.10 32bit:
#uname -a
Linux cavemanpc 2.6.31-22-generic #63-Ubuntu SMP Wed Aug 18 22:54:26 UTC
2010 i686 GNU/Linux

# free -m
 total   used   free sharedbuffers cached
Mem:  3000   1847   1152  0120961
-/+ buffers/cache:766   2234
Swap: 4769  0   4769

My Ubuntu XML related packages:
r...@cavemanpc:~# dpkg -l | grep -i libxml | awk '{ print $2}'
libxml++2.6-2
libxml++2.6-dev
libxml-commons-external-java
libxml-commons-resolver1.1-java
libxml-java-openoffice.org
libxml-parser-perl
libxml-twig-perl
libxml-xpath-perl
libxml2
libxml2-dev
libxml2-utils
libxmlgraphics-commons-java
python-libxml2

Thanks

Caveman



On Wed, Aug 25, 2010 at 12:43 AM, Orvalho Augusto orvaq...@gmail.comwrote:

 It seems to be a bug on the XML package.

 This is what I run (and it is not the only file):
  library(XML)
  doc - xmlDoc(Malaria_Grave.xml)

  *** caught segfault ***
 address 0x9, cause 'memory not mapped'

 Traceback:
  1: .Call(RS_XML_createDocFromNode, node, PACKAGE = XML)
  2: xmlDoc(Malaria_Grave.xml)

 Possible actions:
 1: abort (with core dump, if enabled)
 2: normal R exit
 3: exit R without saving workspace
 4: exit R saving workspace
 Selection: 1
 aborting ...
 Segmentation fault

 ##=
  sessionInfo()
 R version 2.11.1 (2010-05-31)
 i686-pc-linux-gnu

 locale:
  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=C  LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
  [9] LC_ADDRESS=C   LC_TELEPHONE=C
 [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base

 other attached packages:
 [1] XML_3.1-1
 

 ##=

 Thanks
 Caveman


 On Wed, Aug 25, 2010 at 12:02 AM, Gavin Simpson 
 gavin.simp...@ucl.ac.ukwrote:

 On Tue, 2010-08-24 at 23:35 +0200, Orvalho Augusto wrote:
  I have one XML file with 30MB that I need to read the data.
 
  I try this;
  library(XML)
  doc - xmlDoc(Malaria_Grave.xml)
 
  And R answers like this
   *** caught segfault ***
  address 0x5, cause 'memory not mapped'

 This is most likely a bug in your version (unstated) of the XML package.
 But it may be a problem with the file, though XML shouldn't crash R.
 Make sure you are using the latest version of the XML package and R is
 up-to-date, then retry your code in a new R session. If it still
 segfaults, you need to file a bug report with the maintainer: Duncan
 Temple Lang, and include all the relevant details such as output from

 sessionInfo()

 The .xml file you are trying to read and the code required to reproduce
 the segfault.

 HTH

 G

  Traceback:
   1: .Call(RS_XML_createDocFromNode, node, PACKAGE = XML)
   2: xmlDoc(Malaria_Grave.xml)
 
  Possible actions:
  1: abort (with core dump, if enabled)
  2: normal R exit
  3: exit R without saving workspace
  4: exit R saving workspace
 
 
  Or I try this:
  doc - xmlTreeParse(Malaria_Grave.xml)
 
  I get this
  xmlParseEntityRef: no name
  xmlParseEntityRef: no name
  Error: 1: xmlParseEntityRef: no name
  2: xmlParseEntityRef: no name
 
  Please guys help this simple mortal!
  Caveman
 
[[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

 --
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
  Dr. Gavin Simpson [t] +44 (0)20 7679 0522
  ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
  Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
  Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
  UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%







[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Parsing a XML file

2010-08-24 Thread Duncan Temple Lang

xmlDoc() is not the function to use to parse a file.

Use

   doc = xmlParse(Malaria_Grave.xml)


xmlDoc() is for programmatically creating a new XML within R.
It could be more robust to being called with a string, but
the key thing here is that it is not the appropriate function for what
you want.


Also, if there had been a problem with the parsing, you'd need to give
me/us the offending XML  file so that we could have a chance of reproducing
the problem.

   D.


On 8/24/10 2:35 PM, Orvalho Augusto wrote:
 I have one XML file with 30MB that I need to read the data.
 
 I try this;
 library(XML)
 doc - xmlDoc(Malaria_Grave.xml)
 
 And R answers like this
  *** caught segfault ***
 address 0x5, cause 'memory not mapped'
 
 Traceback:
  1: .Call(RS_XML_createDocFromNode, node, PACKAGE = XML)
  2: xmlDoc(Malaria_Grave.xml)
 
 Possible actions:
 1: abort (with core dump, if enabled)
 2: normal R exit
 3: exit R without saving workspace
 4: exit R saving workspace
 
 
 Or I try this:
 doc - xmlTreeParse(Malaria_Grave.xml)
 
 I get this
 xmlParseEntityRef: no name
 xmlParseEntityRef: no name
 Error: 1: xmlParseEntityRef: no name
 2: xmlParseEntityRef: no name
 
 Please guys help this simple mortal!
 Caveman
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.