E.Horn wrote:
> Hey!

Back for another bite at this apple I see...

> Does the XML SIMPLE Modul work if i only want to get the content of
> the text between the tags?

Of course. Have you tried it?

> I want to parse this xmlfile so that there is just CHINA,Hallo,27832

OK.

> Or do i have to use the Modul XML parser?

Well, XML::Simple uses XML::Parser by default. You could extract the data
using only XML::Parser. Or any of a host of other modules.

As I and others have told you before, you need to get a basic understanding
of the XML parsing concepts by studying something like
http://perl-xml.sourceforge.net/faq/. If you just want to get this problem
solved and not bother with the learning process, perhaps you need to hire
someone to write this part of the program for you.

It's trivial to write a program to extract the values you're looking for
from the example you gave. If your data varies (i.e. multiple <ResultItem>'s
per <egQuery>), you'll have to consider some of the options that XML::Simple
has for constructing the tree.

Or, perhaps an XPath approach like XML::XPath would be better, as others
have pointed out to you.

For XML::Simple, try the little program below. It will dump out the tree
built by XML::Simple. Then you can see how to retrieve the values you're
interested in...

#!/usr/bin/perl

use XML::Simple;
$x = XMLin(\*DATA);
use Data::Dumper;
print Dumper($x);
__DATA__
<Result>

        <Term>china</Term>

<egQuery>

             <ResultItem>
                  <DbName>Hallo</DbName>
                  <MenuName>PubMed</MenuName>
                  <Count>27832</Count>
                  <Status>Ok</Status>
             </ReultItem>
</egQuery>


</Result>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to