Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Thanks for the help all :) The solution I ended using was writing an adaptor mod for CSS::Adaptor.
package CSS::Adaptor::XML; $VERSION = 1.00; use CSS::Adaptor; @ISA = ('CSS::Adaptor'); use strict; use warnings; sub output_rule { my ($self, $rule) = @_; #loop on each selector foreach ($rule->selectors(@_)){ #grab the selector name my $selector = $rule->selectors; print "\t\<style name=\"".$selector."\"\>\n"; #loop on each selector's properties foreach ($rule->properties(@_)){ my @properties = $rule->properties; foreach my $line (@properties){ my %properties = split (/[:;]\s+/,$line); print "\t\t\<property name=\"".$_."\"\>".$properties{$ +_}."\<\\property\>\n" for ( keys %properties ); } } #closing style print "\t\<\\style\>\n"; } } 1; __END__
Then I call it like so:
my $css = CSS->new ({'adaptor' => 'CSS::Adaptor::XML'}); $css->read_string($css-passed-as-string); print $css->output(); $css->purge();
It gives me the css file in an xml format, which is what I was looking for. I would always be grateful for any suggestions to make this code better, stronger, faster. Thanks again for your help monks :)

In reply to Re: regex question by Anonymous Monk
in thread regex question by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2022-08-12 15:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found