Jan. 5, 2009
2:48 p.m.
Hi, Martin Aspeli wrote:
once I get the HtmlProcessingInstruction node, how can I get the value of its pseudo-attributes (href and type, in this case)? The attr dict is empty...
As you say, they are not attributes. The content of a processing instruction is application specific plain text, according to the XML specification. http://www.w3.org/TR/REC-xml/#sec-pi While there is some simple support for the xml-stylesheet processing instruction in plain lxml.etree, it's not currently enabled in lxml.html, and it's not available for any other PI target. Your best bet is to parse the PI content yourself (.target and .text properties). Stefan