SAX: Short tag's ...

Diez B. Roggisch deets at nospam.web.de
Mon Oct 5 17:02:21 CEST 2009


Thomas Lehmann wrote:

> Hi!
> 
> Is there a way to recognize short tags in a XML?
> I'm implementing a SAX handler...
> 
> Problem: storing the XML code I would need this information
> in the startElement ...
> 
> How can I handle this?
> 
> <element id="abc" />
> <element id="xyz" >any text</element>

I don't think there is a (standard) way, and it shouldn't matter (unless you
are actually talking about HTML, where sadly enough it does).

In XML, <foo></foo> is the exact same thing as <foo/>. 

Or do you need to *write* XML with shortened tags?

Diez



More information about the Python-list mailing list