Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

parse Tomcat XML configuration files

by penantes (Acolyte)
on Mar 01, 2005 at 23:32 UTC ( [id://435650]=perlquestion: print w/replies, xml ) Need Help??

penantes has asked for the wisdom of the Perl Monks concerning the following question:

Wise monks,
Im trying to to parse the server.xml of a tomcat config so I can collect its configuration, I imagine the best way is to use XML::Parse. My problem is I'm not understanding the explanation... Can someone give and example please?
Best Regards,
NunoA

janitored by ybiC: Retitle from less-than-descriptive and site-search-hindering-one-word "Tomcat"

Replies are listed 'Best First'.
Re: parse Tomcat XML configuration files
by borisz (Canon) on Mar 01, 2005 at 23:52 UTC
    Propably it is best to start wirth XML::Simple since it is easy to use.
    Anyway, I do not know XML::Parse Did you mean XML::Parser?
    There is a samples directory in the distribution with examples.
    Boris
Re: parse Tomcat XML configuration files
by fauria (Deacon) on Mar 02, 2005 at 01:02 UTC
    You can use XML::Simple and change the hashref.

    use XML::Simple; use Data::Dumper; my $tomcat_file = '/var/tomcat4/conf/server.xml'; my $tomcat_conf = XMLin($tomcat_file) or die "Error reading config: $! +"; print Dumper $tomcat_conf; #Modify hashref $tomcat_conf my $modified_xml = XMLout($tomcat_conf, NoAttr => 1); print Dumper $modified_conf;
Re: parse Tomcat XML configuration files
by penantes (Acolyte) on Mar 02, 2005 at 09:26 UTC
    Yep, I meant Parser... ;)
    So, simple is my thing, I gonna try it perhaps its simpler for me to understand.

    Thank you borisz, fauria.
    Nuno A

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://435650]
Approved by davidj
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-04-23 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found