<div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div> Re:Re: [lxml-dev] About the position of html parsing by HTML Target
         parser<br><div><br><br></div><pre>2009-07-17,"Nicholas Dudfield" &lt;<a href="mailto:ndudfield@gmail.com">ndudfield@gmail.com</a>&gt; 
&gt;Wow, someone else with this requirement. I was meaning to post to the
&gt;list about this. I'm using lxml to implement a XPath / CSS selection
&gt;plugin for a python extensible editor. I'd like to have a mapping of
&gt;view buffer regions to xml nodes.   The workaround I used to get the
&gt;exact character position was to use the feed interface, a character at
&gt;a time and manually monitor bytestream position. It's fairly slow
&gt;though. I'd like to implement this in CYthon or use whatever
&gt;underlying facility there is to speed it up.
&gt;
Thank you for your suggestion. I have another idea that I can cumulate total characters of tags and text parsed when I encounter an element, that will mean I have to set a counter to add characters got by startElement function and data function of target parser。This is not an accurate result although. <br>    But the key problem is that we need high parsing speed too. I mean we should get the position value during the parsing process. The libxml2's ParsingContext does provide a value of current parsing position. Now I wan't to read it in lxml. So I think I have to define a callback function in libxml2 to access to the value and then alter part of lxml pxi source to receive the value in target parser. I don't know whether this will do, but I am trying. Thank you for your suggestion again! <br>&gt;You can see some screen casts at this forum thread which should make
&gt;it more obvious what I mean re: css / xpath document selections:
&gt;http://www.sublimetext.com/forum/viewtopic.php?f=5&amp;t=547
&gt;
&gt;Cheers.
&gt;_______________________________________________
&gt;lxml-dev mailing list
&gt;<a href="mailto:lxml-dev@codespeak.net">lxml-dev@codespeak.net</a>
&gt;http://codespeak.net/mailman/listinfo/lxml-dev
</pre><br><br><span title="neteasefooter"><hr>
<a href="http://count.mail.163.com/redirect/footer.htm?f=http://gouwu.youdao.com"><br></a>
</span><br><!-- footer --><br><span title="neteasefooter"/><hr/>
<a href="http://count.mail.163.com/redirect/footer.htm?f=http://gouwu.youdao.com">200万种商品,最低价格,疯狂诱惑你</a>
</span>