ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xml-sig
xml-sig
[XML-SIG] Text file to XML representation
by Antonis Kaklis other posts by this author
Oct 21 2009 7:08AM messages near this date
[XML-SIG] [ pyxml-XBEL-2875536 ] 'as' is the keyword in python2.6 | Re: [XML-SIG] Text file to XML representation
& XSLT Hello,
I would like to make a program that takes a text file with the
following representation for example:

outlook = sunny
|   humidity <= 70: yes (2.0)
|   humidity >  70: no (3.0)
outlook = overcast: yes (4.0)
outlook = rainy
|   windy = TRUE: no (2.0)
|   windy = FALSE: yes (3.0)

and convert it to xml file for example:

<?xml version="1.0" encoding="UTF-8"?> 
<DecisionTree type="DescisionTree"> 
       <Test attribute="outlook" operator="=" value="sunny"> 
               <Test attribute="humidity" operator="&lt;=" value="70"> 
                       <Output decision="yes" info="(2.0)"/> 
               </Test> 
               <Test attribute="humidity" operator="> " value="70">
                       <Output decision="no" info="(3.0)"/> 
               </Test> 
       </Test> 
       <Test attribute="outlook" operator="=" value="overcast"> 
               <Output decision="yes" info="(4.0)"/> 
       </Test> 
       <Test attribute="outlook" operator="=" value="rainy"> 
               <Test attribute="windy" operator="=" value="TRUE"> 
                       <Output decision="no" info="(2.0)"/> 
               </Test> 
               <Test attribute="windy" operator="=" value="FALSE"> 
                       <Output decision="yes" info="(3.0)"/> 
               </Test> 
       </Test> 
</DecisionTree> 

Is there a way to do it? I'm new to XML processing With Python
Please help(code, tips anything)
Thanks in advance
Antonis
_______________________________________________
XML-SIG maillist  -  XML-SIG@[...].org
http://mail.python.org/mailman/listinfo/xml-sig
Thread:
Antonis Kaklis
Stefan Behnel

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved