[lxml-dev] invalid tag names get serialized
jholg at gmx.de
jholg at gmx.de
Wed Jul 18 09:48:22 CEST 2007
Hi Stefan,
> > detect it when you try to parse it back in (in vain). Would it be a
> problem
> > to have the tag name checked before it is set for an element?
>
> Not entirely "libxml2 behaviour", since it actually provides functions to
> check names. You just have to use them. Although 'just' is slightly too
> simplistic here. The straight forward patch actually breaks lots of test
> cases, e.g. getiterator('*').
>
> I'll have to look into this, but this is definitely 2.0 stuff. Maybe it
> would
> be enough to check names only in the factory functions, 'el.set()' and
> 'el.attrib.__setitem__()'. Lookup and search methods/functions don't have
> to care.
For my purposes, it would be sufficient if a tree did not serialize successfully; what I want to avoid is that I store/pickle documents that then turn out to not have been well-formed XML in the first place. So maybe that's easier to achieve than to check names straight away, although I fear not...
Holger
--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
More information about the lxml-dev
mailing list