[reportlab-users] pyRXP and processing instructions

Robin Becker reportlab-users@reportlab.com
Mon, 3 Mar 2003 20:39:08 +0000


In article <Pine.LNX.4.10.10303030843420.16047-100000@sumeru.stanford.EDU>, Dennis Allison
<allison@sumeru.stanford.EDU> writes
>
>
>On Mon, 3 Mar 2003, Robin Becker wrote:
>
>> Is anyone using the ReturnComments flag?
>> -- 
>> Robin Becker
>
>Yes, I use it when I parse XML and plan to later reconstruct as one does
>for an edit.  It's important in that context to maintain comments :-)
>
.....how do you distinguish comments from other stray text? eg if I do

>>> pyRXP.Parser(ReturnComments=1)('<a><!-- this looks like a comment--></a>')
('a', None, ['<!-- this looks like a comment-->'], None)
>>> pyRXP.Parser(ReturnComments=1)('<a>&lt;!-- this looks like a comment--></a>')
('a', None, ['<!-- this looks like a comment-->'], None)
>>> 

the two results look identical. If other text follows they start to look different

eg
>>> pyRXP.Parser(ReturnComments=1)('<a><!-- this looks like a comment-->hahahah</a>')
('a', None, ['<!-- this looks like a comment-->', 'hahahah'], None)
>>> pyRXP.Parser(ReturnComments=1)('<a>&lt;!-- this looks like a comment-->hahahah</a>')
('a', None, ['<!-- this looks like a comment-->hahahah'], None)
>>> 

I think people are saying it would be better if the comments were pushed down one level.

eg
>>> pyRXP.Parser(ReturnComments=1)('<a><!-- comment-->hahahah</a>')
('a', None, [('<!--', None, ['comment'], None), 'hahahah'], None)


and had a special tag name eg '<!--'
-- 
Robin Becker