Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Well, i have been trying to get this to work for 30 minutes now with no luck. I even pulled in one the test files from the distro and it didn't "work":
use strict; use warnings; use XML::Generator::PerlData; use XML::Handler::YAWriter; use IO::File; use Data::Dumper; my $handler = XML::Handler::YAWriter->new( Output => new IO::File (">-"), Pretty => { PrettyWhiteIndent => 1, PrettyWhiteNewline => 1, CompactAttrIndent => 1, }, ); my $pd = XML::Generator::PerlData->new(Handler => $handler); my %attrmap = ( zoix => ['bar', 'norkel'] ); my $obj = SomeObj->new(); my %opts = ( attrmap => \%attrmap, skipelements => ['freep'], namespacemap => {'http://localhost/ns/default' => [ 'document' ]}, keymap => {baz => 'norkel'}, ); $pd->parse( $obj, %opts ); package SomeObj; use strict; sub new { my $proto = shift; my %args = @_; my %sh = (foo => 'foobie', bar => 'barbie', baz => 'bazly' ); my @sa = ( 'one', 'two', 'three' ); my @sa2 = ( 'four', 'five', 'six' ); my @sa3 = ( 'seven', 'eight', 'nine' ); my %hashofrefs = (array => \@sa, hash => \%sh ); my @aofas = ( \@sa, \@sa2, \@sa3 ); my %sh2 = (foo => 'foobie', zoix => \%sh, bar => 'barbie', hork => \@sa, baz => 'bazly', bibble => \%hashofrefs, freep => 'funk', fibble => \@aofas ); $args{yick} = \%sh2; my $class = ref( $proto ) || $proto; my $self = bless( \%args, $class ); return $self; }
There could be a bug in this version (0.89) or we could both be missing how to properly use this module. My suggestion is to (well, always explain what you are trying to accomplish first!) pick another module. From the docs, it appears that this one may have been designed to be used with a database. If that is the case, then try XML::Generator::DBI instead. I wrote a tutorial on it over at XML::Generator::DBI Tutorial. Best of luck. :)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to Re: XML::Generator::PerlData and attributes by jeffa
in thread XML::Generator::PerlData and attributes by dda

Title:
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 How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-25 13:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found