search for: read_xml

Displaying 2 results from an estimated 2 matches for "read_xml".

Did you mean: read_all
2009 Sep 04
3
libxml-ruby: How to handle XML::Parser::ParseError?
...er class BadXML < RuntimeError end def load_tasks doc = XML::Parser.file( "qq.xml" ).parse # ... work with document ... rescue XML::Parser::ParseError, BadXML # this is line #40 # ... end end # TaskLoader p TaskLoader.new.load_tasks # this is line #71 Output: read_xml.rb:40:in `load_tasks'': uninitialized constant LibXML::XML::Parser::ParseError (NameError) from read_xml.rb:71 Question: why does ruby interpret XML::Parser::ParseError in rescue- clause as LibXML::XML::Parser::ParseError? Thanks.
2017 Nov 30
2
Help avoiding setting column type two times
...be download freely from http://20dage.dk/R/referendum-2009/raw.tar.gz The code is below but I have also put the code at this place: http://20dage.dk/R/referendum-2009/convert_from_xml.R Best Regards Martin M. S. Pedersen ------- library(xml2) convert_one_file <- function(url) { x <- read_xml(url) Sted <- xml_find_first(x, ".//Sted") StedType <- xml_attr(Sted, "Type") StedTekst <- xml_text(Sted) Parti <- xml_find_all(x, ".//Parti") PartiId <- xml_attr(Parti, "Id") PartiBogstav <- xml_attr(Parti, "Bo...