[XML-SIG] Validation question

Lars Marius Garshol larsga@ifi.uio.no
04 May 1999 16:02:44 +0200

* Robb Shecter
| I'd like to set up an xml validation service.  I've done all my XML
| programming in Java so far, but would like to try Python out.

Cool! You are certainly most welcome here. :)
| I'd like to have an object with a method that takes two parameters;
| a dtd and an xml document, and returns true or false depending
| whether the document conforms to the dtd.

Using xmlproc you can easily do this. However, what do you do if the
document contains a DOCTYPE declaration that points to something else?
xmlproc would let you ignore that and use the same DTD anyway, but
depending on your application this might not be a very XML-like

| For my purposes (making an XML-based middleware system), this could
| work with URLs pointing to the documents, if some caching is done.
| Typically, many documents would be checked against a single dtd.

I have nearly all the code needed to enable this with xmlproc, the
only part missing being the handling of the internal subset. If you
want to outlaw the use of internal subsets in the documents you
validate I can easily release an xmlproc 0.62 which supports DTD
caching in this case. (It could later be extended to support it in all
cases, without changing the externally-visible APIs.)

It's relatively easy to support the internal subset as well, the
problem is finding an approach that is both fast and clean and works
equally well both for in-memory caching within a process and on-disk
caching between processes.

--Lars M.