|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML generation from a text file
Hi all,
-----------------------8<----------------------------------- import os, sys import xml.dom.minidom f=file(sys.argv[1]) result = file(sys.argv[2],"w") doc = xml.dom.minidom.Document()
root=doc.createElementNS("", "someURIs")
doc.appendChild(doc.createProcessingInstruction("xml-stylesheet",
"type=\"text/xsl\" href=\"multiple_input3.xsl\""))
doc.appendChild(root)# read lines from in file
for line in f.readlines():
node = doc.createElementNS("", "file")
node.appendChild(doc.createTextNode(line))
root.appendChild(node)
# write result
result.write(doc.toprettyxml(indent=" ",encoding="ISO-8859-1"))
-----------------------8<-----------------------------------python foo.py Folder_structure.xml Folder_structure.txt does it... but it's a xml centric solution, no place here for xsl... cheers -- XPath free testing software : http://lantern.sourceforge.net Frédéric Laurent http://www.opikanoba.org XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








