Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^3: WxPerl Next button

by stefbv (Deacon)
on Jan 05, 2013 at 12:14 UTC ( #1011784=note: print w/ replies, xml ) Need Help??

in reply to Re^2: WxPerl Next button
in thread WxPerl Next button

I second the use of Wx::SingleChoiceDialog or Wx::MultiChoiceDialog like jmlynesjr sugested.

Parsing XML like you do is not a good choice, use a dedicated module, something like this:

use strict; use warnings; use XML::Simple; use Data::Printer; my $data = do { local $/; <DATA> }; # slurp DATA my $ref = XMLin( $data, #KeyAttr => { Question => 'questionId' }, # unordered data ForceArray => ['item'], ContentKey => '-content' ); p $ref; __DATA__ <Questions> <Question> <questionId>TNHSCS010001</questionId> <question>Jenkins is primiary used of ...</question> <Answers correct="no">Nightly Builds</Answers> <Answers correct="yes">CI Builds</Answers> <Answers correct="no">Report Generation</Answers> <Answers correct="no">All the above</Answers> </Question> <Question> <questionId>TNHSCS010002</questionId> <question>CI builds are setup to ...</question> <Answers correct="yes">Catch potentail build errors</Answers> <Answers correct="no">Find bugs</Answers> <Answers correct="no">Reduce build time</Answers> <Answers correct="no">None of the above</Answers> </Question> </Questions>

Notice that a valid XML must have a root tag. I also changed a little the structure...

Regards, Stefan

Comment on Re^3: WxPerl Next button
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2015-10-10 20:31 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (258 votes), past polls