On Sun, 2005-12-11 at 07:49 -0700, Uche Ogbuji wrote:
<blockquote type="CITE">
<pre><font color="#000000">I got a bounce saying this message had been blocked by XBL, even though the</font><br><font color="#000000">server in question is not listed in XBL. Busted config?</font><br><br><font color="#000000">
On Thu, 2005-12-08 at 10:37 +0000, Petko Petkov wrote:</font><br><font color="#000000">> Hello to everybody,</font><br><font color="#000000">> This is XMLToolkit 0,7,BETA.2. I simplified most of the code. There are</font>
<br><font color="#000000">> a few new features added as well. Now you can use the Binding tool to</font><br><font color="#000000">> Bind XML documents to python objects.</font><br><font color="#000000">> </font><br>
<font color="#000000">> doc = Binding.fromfile('GoogleService.wsdl')</font><br><font color="#000000">> doc.definitions.message</font><br><font color="#000000">> doc.definitions.message[0]</font><br><font color="#000000">
> doc.definitions.message[1]</font><br><font color="#000000">> <a href="http://doc.definitions.message.name">doc.definitions.message.name</a></font><br><font color="#000000">> <a href="http://doc.definitions.message.name">
doc.definitions.message.name</a> = 'bla bla'</font><br><font color="#000000">> doc.definitions.message = '<h1>Hei I can assign XML to elements that</font><br><font color="#000000">> will be parsed on the fly.</h1> Good!'
</font><br><br><font color="#000000">This is a neat feature, and similar to the append_xml_fragment() method</font><br><font color="#000000">in Amara. I do wonder whether it should be the default, though. As an</font><br>
<font color="#000000">example, in Amara the above would set text in that element and escape</font><br><font color="#000000">the angle brackets. If you wanted to add child elements you'd have to</font><br><font color="#000000">
do:</font><br><br><font color="#000000">doc.definitions.message.append_xml_fragment('<h1>Hei I can assign XML to</font><br><font color="#000000">elements that will be parsed on the fly.</h1> Good!')</font><br>
<br><font color="#000000">My worry with your approach is that if I want to use such characters in</font><br><font color="#000000">my regular XML, I'd have to escape them. Rather than doing:</font><br><br><font color="#000000">
doc.definitions.message = '100 < 1000'</font><br><br><font color="#000000">I'd have to do:</font><br><br><font color="#000000">doc.definitions.message = '100 &lt; 1000'</font><br><br><font color="#000000">Which seems a bit odd at the content API level?
</font><br><br><br><font color="#000000">> doc.definitions.message[1] = OtherBinding</font><br><font color="#000000">> doc.definitions.message[2] = OtherElement</font><br><font color="#000000">> doc.definitions.message
[0] = doc.definitions.message[2]</font><br><font color="#000000">> for m in doc.definitions.message:</font><br><font color="#000000">> print m</font><br><font color="#000000">> print <a href="http://m.name">
m.name</a></font><br><font color="#000000">> </font><br><font color="#000000">> doc.xml</font><br><font color="#000000">> doc.xml(encoding = 'utf-8')</font><br><font color="#000000">> doc.xml(encoding = 'utf-8', stream = mystream)
</font><br><font color="#000000">> doc.xml(encoding = 'utf-8', file = 'myGoogle.wsdl')</font><br><font color="#000000">> str(doc.xml)</font><br><font color="#000000">> doc.xml.composestream(stream)</font><br><font color="#000000">
> </font><br><font color="#000000">> As you can see the syntax is similar to Amara XMLToolkit.</font><br><br><font color="#000000">Yes. Nice. What does doc.xml.composestream(stream) do, though?</font><br><br><font color="#000000">
I'm sorry that I don't have much time to peruse your code.</font><br><br><br></pre>
</blockquote>
<table cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td>
<pre>-- <br>Uche Ogbuji Fourthought, Inc.<br><a href="http://uche.ogbuji.net/">http://uche.ogbuji.net</a> <a href="http://fourthought.com/">http://fourthought.com</a><br><a href="http://copia.ogbuji.net/">
http://copia.ogbuji.net</a> <a href="http://4suite.org/">http://4Suite.org</a><br>Articles: <a href="http://uche.ogbuji.net/tech/publications/">http://uche.ogbuji.net/tech/publications/</a>
</pre>
</td>
</tr>
</tbody></table>