[XML-SIG] validating xml

Mark McEahern marklists@mceahern.com
Thu, 9 Aug 2001 14:37:18 -0700


Can I use a schema instead of a DTD?

Thanks,

// mark

-----Original Message-----
From: xml-sig-admin@python.org [mailto:xml-sig-admin@python.org]On
Behalf Of Lars Marius Garshol
Sent: Thursday, August 09, 2001 2:30 PM
To: xml-sig@python.org
Subject: Re: [XML-SIG] validating xml

* Martin v. Loewis
| 
| The easiest solution probably is to install PyXML. That will give
| you the xmlproc parser, which is a validating parser.

To use it you must write a DTD and refer to it from your XML
document.  This should be easy.

| The easiest way to access it is either through SAX:
| 
| xml.sax.sax2exts.XMLValParserFactory.make_parser()
| 
| or by building a DOM tree with a validating parser:
| 
| xml.dom.ext.reader.Sax2.FromXml(data, validate=1)

Note that the first method is much faster than the second, since the
second builds an object structure, while the first does not. If you
actually want the object structure, and not just the results of
validation, that may of course be worth the extra time.

--Lars M.