[lxml-dev] Expose _assertHasRoot as part of the API?

Hi, I'm facing an issue here, that if applying a XSLT the resulting document is empty, the only way to check that is to call _assertHasRoot and catch the AssertionError apparently. Obviously catching AssertionError's is not very recommended, specially because they tend to not be raised when running with -O. Can we add a public API to check if a element tree is empty? Maybe isEmpty()? -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214

Hi Sidnei,
doesn't "tree.getroot() is not None" work for you?
Duh. How could I have missed that. Sorry. -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214

Hi Sidnei,
doesn't "tree.getroot() is not None" work for you?
Duh. How could I have missed that. Sorry. -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214
participants (2)
-
Sidnei da Silva
-
Stefan Behnel