[XML-SIG] an example of generating XML?

Uche Ogbuji uche.ogbuji@fourthought.com
Mon, 09 Sep 2002 23:02:46 -0600


> Hi,
> I have found the PyXML documentation to be somewhat incomplete. The example
> code, in many cases, doesn't work. Since the W3C documents are more geared
> towards programmers implementing it rather than lowly programmers like
> myself trying to use a particular implementation, you might understand why
> I'm a little bit frustrated.
> 
> Could someone give a simple example of generating a valid, well-formed XML
> file using PyXML?
> 
> Just show me the code to create something simple like:
> 
> <?xml version="1.0"?>
> <data>
>     <node id="1" ack="blah">This is a test node.</node>
>     <node id="2">So is this.</node>
> </data>

It depends on what you're generating it *from*.  I don't mean to be flip, but 
without any further daya, the way I would generate the document above is:

print """<?xml version="1.0"?>
<data>
    <node id="1" ack="blah">This is a test node.</node>
    <node id="2">So is this.</node>
</data>"""

And I know PyXML pretty well.  <wink>


> I want something that works.
> 
> I even tried printing the __doc__ of various functions. No luck, most have
> none.
> 
> And I would certainly go to 4Suite.com and look at their documentation, but
> their domain got stolen. I mean, if you go there, you get a ton of popup
> windows and all this stuff about domain registration. Obviously not 4Suite,
> Inc.

There is no 4Suite Inc., and thus no 4Suite.com :-)

The company is Fourthought, Inc.  ergo http://www.fourthought.com
The project is 4Suite ergo http://4Suite.org


> The documentation I've found just provides code fragments. I can't figure
> out how to make a whole, entire example that can be pasted to a .py file and
> run.
> 
> I'm just having a lot of trouble, I've tried everything I can think of. Any
> help would be much appreciated.

We'll be happy to help.  We just need some specifics.  Can you start at the 
beginning and tell us what you're tying to do?


-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Track chair, XML/Web Services One Boston: http://www.xmlconference.com/
Basic XML and RDF techniques for knowledge management, Part 7 - http://www-106.ibm.com/developerworks/xml/library/x-think12.html
Keeping pace with James Clark - http://www-106.ibm.com/developerworks/xml/library/x-jclark.html
Python and XML development using 4Suite, Part 3: 4RDF - http://www-105.ibm.com/developerworks/education.nsf/xml-onlinecourse-bytitle/8A1EA5A2CF4621C386256BBB006F4CEC