Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

how to print div tag value with ul and ol tag value

by chella2104@gmail.com (Sexton)
on Jan 13, 2016 at 09:04 UTC ( [id://1152641]=perlquestion: print w/replies, xml ) Need Help??

chella2104@gmail.com has asked for the wisdom of the Perl Monks concerning the following question:

This is my code

use strict; use warnings; use feature 'say'; use Mojo; my $ua = Mojo::UserAgent->new; my $array = $ua->get('http://www.sqlite.org/expridx.html')->res->dom- +>find('div > p ')->map('all_text')->join("\n"); print "\n$array\n";

In this code only p tag value But I want p tag value with ul tag value

Please check this link http://www.sqlite.org/expridx.html

Can Anyone help me ??

Replies are listed 'Best First'.
Re: how to print div tag value with ul and ol tag value
by Corion (Patriarch) on Jan 13, 2016 at 09:09 UTC

    What nodes do you expect

    ->find('div > p ')

    to find?

    Maybe now is a good time to learn about Mojo.

      Thank u for your reply .

      That code is print only p tag value not li tag value pls check this link

      http://www.sqlite.org/expridx.html

      In my code output is like

      Normally, an SQL index references columns of a table. But an ..............There are certain reasonable restrictions on expressions that appear in CREATE INDEX statements: ........

      The code not find ul tag values

        How does your reply adress my question? Read Mojo::DOM about the ->find method.

Re: how to print div tag value with ul and ol tag value
by Anonymous Monk on Jan 13, 2016 at 09:53 UTC
Re: how to print div tag value with ul and ol tag value
by natxo (Scribe) on Jan 13, 2016 at 22:21 UTC
    is this what you want (oneliner)?

    $ perl -Mojo -E 'say g("http://www.sqlite.org/expridx.html")->dom->fin +d("p, ul")->map("all_text")->join("\n\n")'
    I get both the p and ul elements.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1152641]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-29 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found