Re: XML InfoSet and property value preservation

On Nov 17, 2005, at 12:16 PM, Julian Reschke wrote:

> I think you're arguing based on a misunderstanding of XML. The XML  
> spec itself doesn't say anything about the prefix in a name being  
> ignorable (as a matter of fact, it doesn't speak of prefixes at  
> all, because that's in the Namespaces spec). Nor does the XML  
> Namespaces spec itself. Nor does DOM, XPath or XSLT. Or SAX (for an  
> example of a non-W3C API).

   Not saying anything isn't the same as requiring that they be  
preserved, but OK.

   I get my impression from the following.  Here is some input XML:

<D:propertyupdate xmlns:D="DAV:" xmlns:L="http://webdav.org/neon/ 
litmus/">
<D:set><D:prop><prop0 xmlns="http://webdav.org/neon/litmus/">value0</ 
prop0></D:prop></D:set>
<D:set><D:prop><prop1 xmlns="http://webdav.org/neon/litmus/">value1</ 
prop1></D:prop></D:set>
<D:set><D:prop><prop2 xmlns="http://webdav.org/neon/litmus/">value2</ 
prop2></D:prop></D:set>
<D:set><D:prop><prop3 xmlns="http://webdav.org/neon/litmus/">value3</ 
prop3></D:prop></D:set>
<D:set><D:prop><prop4 xmlns="http://webdav.org/neon/litmus/">value4</ 
prop4></D:prop></D:set>
<D:set><D:prop><prop5 xmlns="http://webdav.org/neon/litmus/">value5</ 
prop5></D:prop></D:set>
<D:set><D:prop><prop6 xmlns="http://webdav.org/neon/litmus/">value6</ 
prop6></D:prop></D:set>
<D:set><D:prop><prop7 xmlns="http://webdav.org/neon/litmus/">value7</ 
prop7></D:prop></D:set>
<D:set><D:prop><prop8 xmlns="http://webdav.org/neon/litmus/">value8</ 
prop8></D:prop></D:set>
<D:set><D:prop><prop9 xmlns="http://webdav.org/neon/litmus/">value9</ 
prop9></D:prop></D:set>
</D:propertyupdate>

   And here is a snippet in the Python interpreter that reads it and  
writes it back out:

 >>> doc = xml.dom.minidom.parseString(file("/Volumes/data/Users/ 
wsanchez/Developer/Python/Twisted/twisted/web2/dav/test/data/xml/ 
PROPPATCH_request.xml").read())
 >>> xml.dom.ext.Print(doc)
<?xml version='1.0' encoding='UTF-8'?><D:propertyupdate  
xmlns:D='DAV:' xmlns='http://webdav.org/neon/litmus/' xmlns:L='http:// 
webdav.org/neon/litmus/'>
<D:set><D:prop><prop0>value0</prop0></D:prop></D:set>
<D:set><D:prop><prop1>value1</prop1></D:prop></D:set>
<D:set><D:prop><prop2>value2</prop2></D:prop></D:set>
<D:set><D:prop><prop3>value3</prop3></D:prop></D:set>
<D:set><D:prop><prop4>value4</prop4></D:prop></D:set>
<D:set><D:prop><prop5>value5</prop5></D:prop></D:set>
<D:set><D:prop><prop6>value6</prop6></D:prop></D:set>
<D:set><D:prop><prop7>value7</prop7></D:prop></D:set>
<D:set><D:prop><prop8>value8</prop8></D:prop></D:set>
<D:set><D:prop><prop9>value9</prop9></D:prop></D:set>
</D:propertyupdate>

   I've done nothing other than ask my library to read the file and  
then render it back out.  Note that the "L" prefix was not merely  
modified, it was removed entirely.  Clearly the XML library I'm using  
here thinks it's OK to rewrite the XML.  Is this a bug?

	-wsv

Received on Thursday, 17 November 2005 21:11:31 UTC