P is for Practical PerlMonks

### Re^4: How to return two and more values by parsing XML with XML::Rules?

by vagabonding electron (Chaplain)
 on Nov 06, 2012 at 11:36 UTC ( #1002454=note: print w/replies, xml ) Need Help??

Thank you very much!
I noticed now ( but somewhat late :-) ) that your point was yaml output. I have corrected the output presentation in the original post and in the reply to your post.
My main problem however ist that I need to represent the LK-Keys at the same hierarchy level as the AM-Keys. That is, I do need the Outpatient_Clinic_Special infos.
Thank you again for your time I will try to build on your code.
• Comment on Re^4: How to return two and more values by parsing XML with XML::Rules?

Replies are listed 'Best First'.
Re^5: How to return two and more values by parsing XML with XML::Rules?
by Anonymous Monk on Nov 06, 2012 at 11:45 UTC

My main problem however ist that I need to represent the LK-Keys at the same hierarchy level as the AM-Keys.

Your updated output doesn't show that. Only AM04 is found in your sample data.

Anyway, see Re: How to return two and more values by parsing XML with XML::Rules?, save the key callback

    my $amlk = sub { print$_->xpath, "\n";
push @amk, $_->trimmed_text; }; [download] Then register some twig_handlers  'AM_Key' =>$amlk,
'LK_Key' => \$amlk,
[download]
Your updated output doesn't show that.
I am getting old ...
I used your code with XML::Twig for LK_Keys Re^2: How to return two and more values by parsing XML with XML::Rules? but your recent proposal with the callback is of course much better and also shows that I have to learn much much more ...
It is furthermore still the question for me what module should I use as a main option by parsing the data related xml-files?
Thank you very much again!

Create A New User
Node Status?
node history
Node Type: note [id://1002454]
help
Chatterbox?
 [choroba]: needed everywhere, available rarely [LanX]: Question: starting a script from an icon in Windows, but after C-c the window closes ... what I want is to restart in the cmd.exe. Recommendations? [Corion]: LanX: What do you mean by "restart in the cmd.exe" ? [Corion]: Do you want to launch a script and keep the command prompt/console window open? [Corion]: Do you want to wait for a key press before closing the window? [LanX]: I want the command line in the history [tye]: -Mouse [Corion]: Option a) would mean launching cmd.exe /k c:\path\to\ batchfile- launching-perl- script.cmd. Option b) would be to add pause as the last line of said batch file.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2017-03-27 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Should Pluto Get Its Planethood Back?

Results (320 votes). Check out past polls.