For example, from the following string
<?xml version="1.0"?><root><point><message>hello world 1</message></point><point><data><message>hello world 2</message></data></point></root>
if I want to extract message, the result should be
hello world 1
hello world 2
Is there an easy way to do this?
All I can think of is to first find out the position of and and then generate substrings in a loop. Is there a better way?
Your data is not XML, so I guess you’ll have to use a regular expression for that:
If your file was proper XML, then XML::Twig would work nicely. You could even use the
xml_greptool that comes with it to do just what you want.update: with valid XML you can then do
or
or