Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Due to recent job search needs in my family, I've been working on a Perl module that will take a resume in XML format and translate it to a variety of formats. I did some looking around the Internet, but none of the wheels I found were quite the right shape or size for my needs, and I thought it'd be a fun learning project. Right now I have a single object with the following output functions:

  • output_raw - simply uses the toString method to return the raw XML
  • output_html - uses XSLT to transform the XML resume to (X)HTML
  • output_text - uses XSLT to transfor the XML resume to reasonably laid out text, then uses Text::Wrap to wrap long lines to 80 columns
  • output_pdf - the most ambitious, uses XSLT to transform the XML resume into a series of sections and lines that are then fed to PDFLib to generate a PDF file.

My question is this: should I keep this as a single object, or sub-class each output style into a child object. Ie, something like this:

  • Resume - contains the basic functions for importing the XML resume and has an output function that returns the raw XML
  • Resume::HTML - child of Resume that overloads the output function with one that transforms the XML to HTML and returns that
  • Resume::Text - child of Resume that overloads the output function with one that transforms the XML to ASCII text
  • Resume::PDF - contains all of the PDF functions and overloads the output function with one that generates the PDF file

I'm kind of leaning toward this new setup, which I believe leaves me open for future enhancements, but I thought I'd see what the experts have to say. I'd also love to hear any additional features or output formats you think I should add. Once I get more of the code put together, I'll be happy to post it for review.

-rattus

__________
He seemed like such a nice guy to his neighbors / Kept to himself and never bothered them with favors
- Jefferson Airplane, "Assassin"


In reply to XML Resume Module design by rattusillegitimus

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (5)
    As of 2020-10-01 05:04 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      If at first I donít succeed, I Ö










      Results (174 votes). Check out past polls.

      Notices?