Skip Menu |

This queue is for tickets about the XML-Generator-PerlData CPAN distribution.

Report information
The Basics
Id: 55092
Status: open
Priority: 0/
Queue: XML-Generator-PerlData

People
Owner: KHAMPTON [...] cpan.org
Requestors: michael [...] zedeler.dk
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Adding processing instructions
How would it fit the general design if it was possible to add processing instructions using the configuration hash? I'd really like if i could do something like this: my $generator = XML::Generator::PerlData->new( Handler => $builder, pi => { xml => {version => '1.0', encoding => 'UTF-8'}, 'xml-stylesheet' => {type => 'text/xsl', href => 'my.xsl'} } ); Which would then later generate the processing instructions <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="my.xsl"?> It could also be some kind of general solution where some parts of the perl data structure is mapped to processing instructions.
<snip/> Show quoted text
> > I'd really like if i could do something like this: > > my $generator = XML::Generator::PerlData->new( > Handler => $builder, > pi => { > xml => {version => '1.0', encoding => 'UTF-8'}, > 'xml-stylesheet' => {type => 'text/xsl', href => 'my.xsl'} > } > ); > > Which would then later generate the processing instructions > > <?xml version="1.0" encoding="UTF-8"?> > <?xml-stylesheet type="text/xsl" href="my.xsl"?> > > It could also be some kind of general solution where some parts of the > perl data structure is mapped to processing instructions.
Strictly speaking, your example doesn't contain two PIs, it contains one XML declaration and one processing instruction. (two different entities with two separate SAX methods for parsing/generation). If Generator::PerlData isn't reliably generating an XML declaration then that's a bug that needs fixing wholly apart from this feature request. That said, yes, I'd be happy to add a processing_instructions option to the constructor that would behave as you expect for the 'stylesheet' PI. Ticket accepted.
Subject: Re: [rt.cpan.org #55092] Adding processing instructions
Date: Mon, 01 Mar 2010 17:39:44 +0100
To: bug-XML-Generator-PerlData [...] rt.cpan.org
From: Michael Zedeler <michael [...] zedeler.dk>
KHAMPTON via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=55092 > > > <snip/> >
>> I'd really like if i could do something like this: >> >> my $generator = XML::Generator::PerlData->new( >> Handler => $builder, >> pi => { >> xml => {version => '1.0', encoding => 'UTF-8'}, >> 'xml-stylesheet' => {type => 'text/xsl', href => 'my.xsl'} >> } >> ); >> >> Which would then later generate the processing instructions >> >> <?xml version="1.0" encoding="UTF-8"?> >> <?xml-stylesheet type="text/xsl" href="my.xsl"?> >> >> It could also be some kind of general solution where some parts of the >> perl data structure is mapped to processing instructions. >>
> Strictly speaking, your example doesn't contain two PIs, it contains one > XML declaration and one processing instruction. (two different entities > with two separate SAX methods for parsing/generation). If > Generator::PerlData isn't reliably generating an XML declaration then > that's a bug that needs fixing wholly apart from this feature request. >
Well - I could imagine times where you'd like to use XML::Generator::PerlData to generate XML fragments to embed in larger documents, which wouldn't be possible if it always emits an XML declaration. Show quoted text
> That said, yes, I'd be happy to add a processing_instructions option to > the constructor that would behave as you expect for the 'stylesheet' PI.
Just a single stylesheet parameter could do the trick for me. Show quoted text
> Ticket accepted.
Great! Thanks! Please let me know if you need anything from me. Regards, Michael.
Hey Michael, I stole a few minutes to add the processing_instruction option. If you have a sec, you can snag a pre-release version from GitHub here: git://github.com/ubu/xml-generator-perldata.git Give it a spin, and see if it does what you need/expect. -kip