[XML-SIG] Re: sample code - msxml

Laurent Fontanel laurent_fontanel@globalcrossing.com
Tue, 08 May 2001 12:22:06 -0400


This is a multi-part message in MIME format.
--------------5BD27586D3B9A79D098870E9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Arne,

I've never used MSXML to process XML SAX-style, but I've used it to apply XSL stylesheets.
It's really easy with the win32com interface:

import win32com.client

def xml2htm(xmlFile):
   source = win32com.client.Dispatch("Microsoft.xmldom")
   source.async = 0
   source.load(xmlFile)

   style = win32com.client.Dispatch("Microsoft.xmldom")
   style.async = 0
   style.load("mystylesheet.xsl")

   return source.transformNode(style)

if __name__ == '__main__':
   # xml2htm("myfile.xml")

Note also that after source.load(), you can manipulate the whole document tree using DOM calls,
which is pretty neat.

Hope this helps,

Laurent.

--------------5BD27586D3B9A79D098870E9
Content-Type: text/x-vcard; charset=us-ascii;
 name="laurent_fontanel.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Laurent Fontanel
Content-Disposition: attachment;
 filename="laurent_fontanel.vcf"

begin:vcard 
n:Fontanel;Laurent
tel;work:(716) 777-2752
x-mozilla-html:TRUE
org:<IMG SRC="http://www.globalcrossing.com/images/gc_logo4mainmenu.gif">;Systems and Product Development
adr:;;180 S. Clinton Ave.;Rochester;NY;14646;
version:2.1
email;internet:laurent_fontanel@globalcrossing.com
fn:Laurent Fontanel
end:vcard

--------------5BD27586D3B9A79D098870E9--