rules from an xml file

jonny sigmarCdS at hotmail.com
Mon Sep 24 07:34:45 EDT 2007


I have a python code that manages some parameters using some variable
rules that may change from day to day. I'd like that the code will
self-modify according to rules parsed from a xml file:

example:

<rules>
   <rule01>
      <if>
		<or>
			<lessthan par_1="glicemyAtMorning" par_2="80"/>
			<lessthan par_1="glicemyAtNight" par_2="80"/>
			<and>
				<greaterthan par_1="glicemyAtMorning" par_2="0"/>
				<or>
					<equalto par_1="urine" par_2="0"/>
					<equalto par_1="urine" par_2="+/-"/>
					<equalto par_1="urine" par_2="+"/>
				</or>
			</and>
		</or>
	</if>
        <then>
           <sendmessage>Something is wrong!</sendmessage>
        </then>
   </rule01>
   <rule02> ...  </rule02>
   <rule03> ...   </rule03>
</rules>

Due to the fact that rules may change, I have to manage the python
program, parsing the whole xml file, and self-modify the python code
according to these variable rules.
How can I do?




More information about the Python-list mailing list