CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Doubt in LibXML

 



srikrishnan
Novice

Jan 16, 2009, 8:04 PM

Post #1 of 3 (1393 views)
Doubt in LibXML Can't Post

Hi All,

I have written a script for parsing XML using libxml parser. It works fine. I want to store the xml error messages in a variable. But I am not able to find a way for this, may anybody help me?

Below is my script sample:

use XML::LibXML;
my $parser = XML::LibXML->new();
$parser->validation(1);
$parser->load_catalog($catalog_file);
$parser->parse_string($xmlstring);

Regards,
Srikrishnan


shawnhcorey
Enthusiast


Jan 17, 2009, 5:15 AM

Post #2 of 3 (1387 views)
Re: [srikrishnan] Doubt in LibXML [In reply to] Can't Post

You could try `perldoc -f eval`


Code
 
eval { $parser->parse_string($xmlstring); };
if( $@ ){
push @error_messages, $@;
}


__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".

(This post was edited by shawnhcorey on Jan 17, 2009, 5:22 AM)


srikrishnan
Novice

Jan 17, 2009, 9:17 AM

Post #3 of 3 (1382 views)
Re: [shawnhcorey] Doubt in LibXML [In reply to] Can't Post

Hi,

Thanks for your help.

I have one more question.

If we use libxml as a standalone, we have the option of making pretty Indented xml using the following command:

xmllint --format ...

is this possible in perl module?

Regards,
Srikrishnan

In Reply To

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives