Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: XML::Twig output with delimiter

by balakrishnan (Monk)
on Dec 09, 2008 at 13:12 UTC ( #729154=note: print w/replies, xml ) Need Help??

in reply to XML::Twig output with delimiter

I think ,this would help you to get your need,
my $t= XML::Twig->new( twig_handlers => { '_all_' => sub { $_[1]->suffix( " ");}} ); $t->parsefile("new.xml"); my $root= $t->root; my @para= $root->children(); # get the root's children foreach my $para (@para) { print $para->text()."\n"; }

Replies are listed 'Best First'.
Re^2: XML::Twig output with delimiter
by pankaj_it09 (Scribe) on Dec 10, 2008 at 06:17 UTC
    Yes it solved the problem to some extent but I want the result to be in a variable.

    I tried like this :

    my $content = sprintf $para->text()."\n";

    It doesn't seem to work.

      Once again... read the docs. perldoc -f sprintf. If the text of the element includes a % you won't get what you want.

      You don't need sprintf at all in this case. my $content = $para->text()."\n"; will do just fine.

      Yes it works that way.

      If there is any other way then tell me.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://729154]
[Corion]: ambrus: Well, for mathematical notation, I find blackboard much more convenient than a computer. But when inserting text or moving text around, the computer wins obviously
[ambrus]: But either of these is a big problem in practice, so I'd need to spend like thirty years of my life to solve (a) and five more years to solve (b)
[ambrus]: Corion: yes, CURRENTLY the blackboard is more convenient
[ambrus]: and it's not like I want to ban blackboards anyway
[ambrus]: you already have blackboards and a canvas for projector or overhead transparencies (or positive film slide projector, not used for maths) canvas in the same lecture halls today, and switch in a few minutes between presentations,
[ambrus]: they're only difficult to use together.
[ambrus]: overhead transparencies are a nice convenience by the way that mix the two slides, because you can write them in advance and edit them during the presentation easily. but they're not very much in fasion these days.
[ambrus]: you can even print them.
[Discipulus]: ambrus i'm trying out MremoteNG which wrap putty and rdp and many other things..
[Corion]: ambrus: Yes, ideally you would have the ease of overhead projection transparencies and pens drawing on them, combined with the computer generated slide text...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2017-09-26 10:26 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (293 votes). Check out past polls.