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

Re^3: WxPerl Next button

by stefbv (Curate)
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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011784]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2018-06-19 06:46 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.