XML Parsing

Sambit Samal sambit2005 at gmail.com
Mon Sep 4 05:38:10 EDT 2017


Hi ,

Need help in Python Script using xml.etree.ElementTree  to update the value of any element in below XML ( e.g SETNPI to be 5 ) based on some constraint ( e.g <ruleset id="2"> ) .



<?xml version="1.0"?>
          <TRN xmlns:xsi="http:/www.w3.org/2001/XMLSchema-instance">
        <ProfileName>DRATRN</ProfileName>
            <Rules>
        
        <ruleset id="1">
         <Priority>1</Priority>
         <!-- Set_NAI_1_NPI_1_CLNGPN -->
           <TriggerPoint>
         <ConditionTypeCNF>1</ConditionTypeCNF>
             <SPT id="0">
             <Group>0</Group>
              <CALLEVENT>ORIG</CALLEVENT>
             <CALLEVENT>CFORIG</CALLEVENT>
            <CALLEVENT>TERM</CALLEVENT>
               </SPT>
            </TriggerPoint>
            <Action>
              <CLNGPN_DIGITS>
           <SETNAI>1</SETNAI>
              <SETNPI>1</SETNPI>
              </CLNGPN_DIGITS>
             <CAUSE>CONTINUE</CAUSE>
            </Action>
           </ruleset>

          <ruleset id="2">
          <Priority>2</Priority>
            <TriggerPoint>
            <ConditionTypeCNF>1</ConditionTypeCNF>
             <SPT id="0">
              <Group>0</Group>
              <CALLEVENT>TERM</CALLEVENT>
              </SPT>
                </TriggerPoint>
            <Action>
              <CLDPN_DIGITS>
               <SETNAI>1</SETNAI>
               <SETNPI>1</SETNPI>
               </CLDPN_DIGITS>
               <CAUSE>CONTINUE</CAUSE>
               </Action>
               </ruleset>



More information about the Python-list mailing list