Perl: the Markov chain saw | |
PerlMonks |
Re: Strip out value between xml tagsby sauoq (Abbot) |
on Mar 18, 2015 at 18:42 UTC ( [id://1120483]=note: print w/replies, xml ) | Need Help?? |
I'm trying to strip out the value that is between <CorpActnEvtId>12345678</CorpActnEvtId>. By which, I think you mean you want to retrieve the value between the CorpActnEvtid opening and closing tags... (Strip out, to me, usually menas you want to delete it, and leave the rest.) Parsing it with one of the XML modules is the right answer. A quick answer, if this is a one-off thing or something, is to use something like
I might do it that way if I had a pile of data I had to munge up just once, and if I didn't need much more from that snippet of XML. But even so, it's making some assumptions (like the ID is always just digits and there is no whitespace within the tag.) This is terribly brittle and, if you have to do it once, you'll probably have to do it again. So I'm not recommending you do it this way, particularly as you weren't able to work it out on your own. That said, here's some rope; it's up to you not to hang yourself with it.
-sauoq "My two cents aren't worth a dime.";
In Section
Seekers of Perl Wisdom
|
|