Changeset 3072:8be17949f72e in livinglogic.python.xist

Show
Ignore:
Timestamp:
12/20/07 20:28:31 (12 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Update xfind examples.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • EXAMPLES.xml

    r2932 r3072  
    110110from ll.xist import parsers 
    111111 
    112 node = parsers.parseURL("http://www.python.org/", tidy=True) 
     112node = parsers.parseurl("http://www.python.org/", tidy=True) 
    113113</prog> 
    114114 
     
    124124<prompt>&gt;&gt;&gt; </prompt><input>from ll.xist import parsers</input> 
    125125<prompt>&gt;&gt;&gt; </prompt><input>from ll.xist.ns import html</input> 
    126 <prompt>&gt;&gt;&gt; </prompt><input>node = parsers.parseURL("http://www.python.org/", utidy=True)</input> 
    127 <prompt>&gt;&gt;&gt; </prompt><input>for img in node//html.a/html.img:</input> 
    128 <prompt>... </prompt><input>   print img["src"]</input> 
     126<prompt>&gt;&gt;&gt; </prompt><input>node = parsers.parseurl("http://www.python.org/", utidy=True)</input> 
     127<prompt>&gt;&gt;&gt; </prompt><input>for img in node.walknode(html.a/html.img):</input> 
     128<prompt>... </prompt><input>   print img.atts.src</input> 
    129129<prompt>... </prompt><input></input> 
    130130http://www.python.org/images/python-logo.gif 
     
    140140<prompt>&gt;&gt;&gt; </prompt><input>from ll.xist import parsers, xfind</input> 
    141141<prompt>&gt;&gt;&gt; </prompt><input>from ll.xist.ns import html</input> 
    142 <prompt>&gt;&gt;&gt; </prompt><input>node = parsers.parseURL("http://www.python.org/", tidy=True)</input> 
    143 <prompt>&gt;&gt;&gt; </prompt><input>for link in node//html.a/xfind.contains(html.img):</input> 
    144 <prompt>... </prompt><input>   print link["href"], str((link/html.img)[0]["src"])</input> 
     142<prompt>&gt;&gt;&gt; </prompt><input>node = parsers.parseurl("http://www.python.org/", tidy=True)</input> 
     143<prompt>&gt;&gt;&gt; </prompt><input>for path in node.walkpath(html.a/html.img):</input> 
     144<prompt>... </prompt><input>   print path[-2].attrs.href, path[-1].attrs.src</input> 
    145145http://www.python.org/ http://www.python.org/images/python-logo.gif 
    146146http://www.python.org/#left%2dhand%2dnavigation http://www.python.org/images/trans.gif 
     
    156156<prompt>&gt;&gt;&gt; </prompt><input>from ll.xist import parsers</input> 
    157157<prompt>&gt;&gt;&gt; </prompt><input>from ll.xist.ns import html</input> 
    158 <prompt>&gt;&gt;&gt; </prompt><input>node = parsers.parseURL("http://www.python.org/", tidy=True)</input> 
    159 <prompt>&gt;&gt;&gt; </prompt><input>misc.count(node//html.a)</input> 
    160 90 
     158<prompt>&gt;&gt;&gt; </prompt><input>node = parsers.parseurl("http://www.python.org/", tidy=True)</input> 
     159<prompt>&gt;&gt;&gt; </prompt><input>misc.count(node.walk(html.a))</input> 
     16083 
    161161</tty> 
    162162