[libxml-devel] Guaranteed non-crashing way to load an XML document?
Keith Fahlgren
keith at oreilly.com
Tue Feb 5 10:46:20 EST 2008
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
More information about the libxml-devel
mailing list