On 2/5/08 7:20 AM, Saurabh Nanda wrote:
> Is there a preferred (guaranteed to not crash) way of parsing XML
> strings in libxml? Here's what I'm doing:
> 
>     parser=XML::Parser.new
>     parser.string= content
>     xml = parser.parse
> 
> Is there a better way? I've attaced the error log, just in case it helps.

Do you have crashes that can break out of a begin block? What does that content
look like?

parser = XML::Parser.new
# => #<XML::Parser:0x702484>
parser.string = "<notxml>"
# => "<notxml>"
begin
  xml = parser.parse
rescue XML::Parser::ParseError
  # ?
end


Keith
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to