[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.&nbsp; 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&nbsp;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>&gt;From: "Martin v. Loewis" <MARTIN@LOEWIS.HOME.CS.TU-BERLIN.DE>
<DIV></DIV>&gt;To: rsalz@zolera.com 
<DIV></DIV>&gt;CC: linudom@hotmail.com, xml-sig@python.org 
<DIV></DIV>&gt;Subject: Re: [XML-SIG] Validating a DOM w/xmlproc? 
<DIV></DIV>&gt;Date: Sat, 28 Apr 2001 08:45:16 +0200 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; &gt; interesting question: can you invoke DOM methods such that the 
<DIV></DIV>&gt; &gt; resultant structure is invalid? Off the top of my head, I don't 
<DIV></DIV>&gt; &gt; know. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Certainly. Suppose you have the DTD 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;<!ELEMENT foo EMPTY> 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Still, it is certainly possible to do 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; &gt;&gt;&gt; d=imp.createDocument(None,"foo",None) 
<DIV></DIV>&gt; &gt;&gt;&gt; e=d.createElement("bar") 
<DIV></DIV>&gt; &gt;&gt;&gt; d.documentElement.appendChild(e) 
<DIV></DIV>&gt; &gt;&gt;&gt; d.toxml() 
<DIV></DIV>&gt;'<?xml version="1.0" ?>\n<FOO><BAR /></FOO>' 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;How could the DOM implementation possibly know what DTD I had in mind? 
<DIV></DIV>&gt;I could have provided a DocumentType node also, but which of these 
<DIV></DIV>&gt;operations should then have failed, and how? Answer: the DOM does not 
<DIV></DIV>&gt;care about validity. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;During modification operations, it might well happen that the document 
<DIV></DIV>&gt;becomes invalid, eg. when removing one node and inserting a different 
<DIV></DIV>&gt;one elsewhere. If the DOM would reject such modifications, it would be 
<DIV></DIV>&gt;useless. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Regards, 
<DIV></DIV>&gt;Martin 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;_______________________________________________ 
<DIV></DIV>&gt;XML-SIG maillist - XML-SIG@python.org 
<DIV></DIV>&gt;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>