Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: XML::Generator::PerlData and attributes

by jeffa (Bishop)
on Oct 14, 2003 at 13:07 UTC ( [id://299093]=note: print w/replies, xml ) Need Help??


in reply to XML::Generator::PerlData and attributes

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)

Replies are listed 'Best First'.
Re: Re: XML::Generator::PerlData and attributes
by dda (Friar) on Oct 14, 2003 at 13:29 UTC
    Thanks jeffa. I'm not using DBI -- what I'm trying to do is to make XML document from LDAP tree. I'm getting an ugle XML code without attibutes. :)

    Does it worth to email to the author of this module?

    --dda

      I would wait at least a day before emailing the author - maybe someone here at the Monastery will figure it out. If and when you do email the author, be very consise and polite (you know this ;)). Matts has written many XML modules and perhaps he has used this one before, you might want to /msg him and invite him to look at your question. mirod is another XML Wizard, he may have an alternative for you.

      Another outlet is http://rt.cpan.org - if this is a bug, you can report it to the author at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=XML-Generator-PerlData

      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)
      

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-03-28 15:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found