[xml] Use of xmlValidate* functions in tree

Hash: SHA1

When manipulating libxml2's tree, when is it required to call the
xmlValidate*() functions? I did some testing, and it seems that libxml2
will happily create attributes or elements that do not conform to the
lexical space of Name, etc. When the tree is serialized the XML is
invalid, but libxml2 doesn't explode or anything like that.

Also, I'm curious to know where lies the burden for checking the
validity of these things. Is the client code expected to check? If so,
is there a "safe" wrapper that will automatically do the checks? I
understand that it's more efficient not to check if not strictly
necessary, but it's easy to miss a precondition here or there if you're
not paying attention.

I should note that my C knowledge is abysmal to none, so if I'm just
blithering nonsense, please say so. :-)
- --
 Edward Z. Yang                        GnuPG: 0x869C48DA
 HTML Purifier <http://htmlpurifier.org> Anti-XSS Filter
 [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]