I've been all through python.org site and carefully read ``Python & XML'' by Jones and Drake, but I can't find any body of practice about the generation of XML files from scratch. All the existing practice seems to be about reading or modifying existing XML documents. I want to capture data from a GUI or other source and store it as an XML document.
I've been doing this for a while, using the minidom in 2.2, but apparently all the (admittedly undocumented) features I was using went away in 2.3, and the new methods are a lot uglier. This means that when we upgrade to 2.3 or 2.4 locally, I have to go back and rewrite a lot of existing, working scripts. Here's the document I wrote that describes how I did it in 2.2: http://www.nmt.edu/tcc/help/pubs/pyxml/ Look under the last chapter, ``Creating a document from scratch.'' I use the constructors such as Document() and Element() in that minidom version, but now they want me to use the .createElement() and other factory methods from the Document object. This is much more awkward. Either I have to pass the Document object to any piece of code that needs to create an Element object, or the code needs to dig the .ownerDocument attribute out of some handy Node object so it has access to the factory methods. There's one situation where even this approach doesn't work. I have a script that generates a document fragment that gets included in an XHTML page using server-side includes. I can't instantiate it as a Document object, because then I would get an <?xml...?> processing instruction at the top, which is not something I want inside the <body> element of a web page. Previously I was getting around this problem by using a DocumentFragment object, but such objects in the minidom have an .ownerDocument attribute set to None. So I have to instantiate an empty Document object *just* to get access to the factory methods. This is what we software old-timers call a KLUGE. Comments? Is there something out there I don't know about? Best regards, John Shipman ([EMAIL PROTECTED]), Applications Specialist, NM Tech Computer Center, Speare 119, Socorro, NM 87801, (505) 835-5950, http://www.nmt.edu/~john ``Let's go outside and commiserate with nature.'' --Dave Farber _______________________________________________ XML-SIG maillist - XML-SIG@python.org http://mail.python.org/mailman/listinfo/xml-sig