[XML-SIG] Validating a DOM w/xmlproc?
Dom Linu
linudom@hotmail.com
Sat, 28 Apr 2001 07:32:55 -0000
<html><DIV>
<P>Yep, in this case the DOM is assembled by parsing a flat file and creating Nodes using 4DOM. It is then handed off to another process that wishes to validate it with xmlproc-- I guess it will have to "reconstitute" it to a form xmlproc can deal with-- I've played with using the InputSourceFactory interface and the parser's set_inputsource_factory in xmlproc to return a custom file-like object-- but then I'd have to wrap the DOM up like a file-- probably about as much work as turning it back into text.</P>
<P>Thanks for the input!!<BR><BR></P></DIV>
<DIV></DIV>
<DIV></DIV>>From: "Martin v. Loewis" <MARTIN@LOEWIS.HOME.CS.TU-BERLIN.DE>
<DIV></DIV>>To: rsalz@zolera.com
<DIV></DIV>>CC: linudom@hotmail.com, xml-sig@python.org
<DIV></DIV>>Subject: Re: [XML-SIG] Validating a DOM w/xmlproc?
<DIV></DIV>>Date: Sat, 28 Apr 2001 08:45:16 +0200
<DIV></DIV>>
<DIV></DIV>> > interesting question: can you invoke DOM methods such that the
<DIV></DIV>> > resultant structure is invalid? Off the top of my head, I don't
<DIV></DIV>> > know.
<DIV></DIV>>
<DIV></DIV>>Certainly. Suppose you have the DTD
<DIV></DIV>>
<DIV></DIV>><!ELEMENT foo EMPTY>
<DIV></DIV>>
<DIV></DIV>>Still, it is certainly possible to do
<DIV></DIV>>
<DIV></DIV>> >>> d=imp.createDocument(None,"foo",None)
<DIV></DIV>> >>> e=d.createElement("bar")
<DIV></DIV>> >>> d.documentElement.appendChild(e)
<DIV></DIV>> >>> d.toxml()
<DIV></DIV>>'<?xml version="1.0" ?>\n<FOO><BAR /></FOO>'
<DIV></DIV>>
<DIV></DIV>>How could the DOM implementation possibly know what DTD I had in mind?
<DIV></DIV>>I could have provided a DocumentType node also, but which of these
<DIV></DIV>>operations should then have failed, and how? Answer: the DOM does not
<DIV></DIV>>care about validity.
<DIV></DIV>>
<DIV></DIV>>During modification operations, it might well happen that the document
<DIV></DIV>>becomes invalid, eg. when removing one node and inserting a different
<DIV></DIV>>one elsewhere. If the DOM would reject such modifications, it would be
<DIV></DIV>>useless.
<DIV></DIV>>
<DIV></DIV>>Regards,
<DIV></DIV>>Martin
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>_______________________________________________
<DIV></DIV>>XML-SIG maillist - XML-SIG@python.org
<DIV></DIV>>http://mail.python.org/mailman/listinfo/xml-sig
<DIV></DIV><br clear=all><hr>Get your FREE download of MSN Explorer at <a href="http://explorer.msn.com">http://explorer.msn.com</a><br></p></html>