<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 20, 2011, at 7:43 PM, Kevin Horn wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex; ">It could even use Lore's parser, twisted.lore.tree.parseFileAndReport ;)<br><br>Jean-Paul<br><br></blockquote><div>&nbsp;</div></div>Yes, but:<br><br>- The docs (well, docstrings) aren't very clear about exactly what that does, or what quirks it might or might not have.<span class="Apple-converted-space">&nbsp;</span><br></span></blockquote><div><br></div><div>The source is pretty short, and has some very useful comments:</div><div><br></div><div>&lt;<a href="http://twistedmatrix.com/trac/browser/trunk/twisted/lore/tree.py#L1021">http://twistedmatrix.com/trac/browser/trunk/twisted/lore/tree.py#L1021</a>&gt;</div><div><br></div><div>It is a thin wrapper around xml.sax.make_parser().parse() which uses a fixed set of DTDs, never downloads them, and remembers the file name and line number of errors so that the exceptions are actually useful to someone editing the XML.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">- Is the DOM document it returns a typical XHTML DOM document?&nbsp; Is there anything special/different about it since it's a Lore XHTML doc?<br></span></blockquote><div><br></div><div>Yep, it's plain vanilla XML objects.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">- Consider the number of tickets open involving Lore's parser (or at least there were several when I started this whole business).<br></span></blockquote><div><br></div><div>This isn't the soupy mess of Lore's tag munging. It's just the thing it uses to get the DOM loaded in the first place.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">- The whole point of this project is to stop using (and by extension supporting/maintaining) Lore, so it seems kind of backwards to me to depend on it.<br></span></blockquote><div><br></div><div>parseFileAndReport is actually useful enough that I'd like to see it move somewhere else - maybe somewhere in twisted.python, because this is useful knowledge.</div><div><br></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">- I'd rather deal with an etree-a-like, than a straight DOM document (admittedly, personal preference)<br></span></blockquote><div><br></div><div>Isn't there a function to do the conversion somewhere?</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">- I certainly don't want to rewrite everything at this point ;)<br></span></blockquote></div><div><br></div><div>If you can't use this function, the methods that it calls should be simple enough that you can just crib them :).</div><div><br></div></body></html>