提取Oracle form xml格式数据的最简单方法

easiest way to extract Oracle form xml format data

我有几百个 oracle 表格,我将它们转换成 XML。我想提取任何可能对我有用的文本(值),以检查我拥有的所有表单之间的某些相互依赖性。

我尝试将它们插入到数据库中的 table 中,格式为 XML,但挑战是 table 的大小相当大,大约需要 10 分钟才能完成查询table.

因此我想从 XML 格式中删除所有不必要的文本,只保留需要的文本。

你有什么建议?我正在使用 python 有用的信息形式我将像块名称,在 oracle 形式中编写的任何程序(在程序单元标记中)

此外,请注意我的 Oracle XML 格式是:

<?xml version = '1.0' encoding = 'UTF-8'?>
<Module version="111020200" xmlns="http://xmlns.oracle.com/Forms">
   <FormModule Name="TEST" DirtyInfo="true" Title="MODULE1" MenuModule="DEFAULT&amp;SMARTBAR" ConsoleWindow="WINDOW1">
      <Coordinate CharacterCellWidth="5" DefaultFontScaling="true" CoordinateSystem="Real" CharacterCellHeight="14" RealUnit="Point"/>
      <Block Name="BLOCK2" DirtyInfo="true" ScrollbarWidth="9" ScrollbarLength="135">
         <Item Name="ROUND_RULE" Prompt="round rule" YPosition="143" TabPageName="" XPosition="110" DirtyInfo="true" Width="45" PromptAttachmentOffset="11" PromptAlignOffset="1" CanvasName="CANVAS5" Height="14"/>
         <Item Name="ROUND_PREM" MaximumLength="28" YPosition="143" XPosition="215" DataType="Number" Prompt="round prem" TabPageName="" DirtyInfo="true" PromptAttachmentOffset="7" Width="102" PromptAlignOffset="1" CanvasName="CANVAS5" Height="14"/>
         <Item Name="ITEM7" YPosition="178" TabPageName="" Label="return" XPosition="142" DirtyInfo="true" Width="45" CanvasName="CANVAS5" Height="14" ItemType="Push Button">
            <Trigger Name="WHEN-BUTTON-PRESSED" TriggerText=":value := ffn_round_premium(:Round_rule,:Round_Prem);" DirtyInfo="true"/>
         </Item>
         <Item Name="VALUE" MaximumLength="28" YPosition="209" XPosition="145" DataType="Number" Prompt="value" TabPageName="" DirtyInfo="true" PromptAttachmentOffset="5" Width="97" PromptAlignOffset="2" CanvasName="CANVAS5" Height="14"/>
      </Block>
      <Canvas Name="CANVAS5" ViewportHeight="324" ViewportWidth="360" DirtyInfo="true" Width="360" Height="324" WindowName="WINDOW1"/>
      <ProgramUnit Name="FFN_ROUND_PREMIUM" ProgramUnitType="Function" ProgramUnitText="Function ffn_round_premium (P_Round_rule in varchar2,P_Rounded_Prem number) &amp;#10;RETURN NUMBER IS&amp;#10;   Cursor cr_round_premium  is   select v_calculation_type,v_round_needed,v_decimal_side,&amp;#10;                                        n_round_digits,v_round_method,n_round_to ,&amp;#10;                                        v_first_cut_digit_check &amp;#10;                                 from Gnlu_calc_rounding_rules   &amp;#10;                                 where v_round_rule_ref = p_round_rule;    &amp;#10;   Lv_cal_type varchar2(10);&#x9;&amp;#10;   Lv_round_needed varchar2(1);&#x9;   &amp;#10;   Lv_decimal_side varchar2(10);  &amp;#10;   Ln_round_digits number; &amp;#10;   Lv_round_method varchar2(10); &amp;#10;   Ln_round_to number; &amp;#10;   Lv_first_cut_digit_check varchar2(1);     &amp;#10;   Ln_last_digit number;  &amp;#10;   Ln_previous_digit number;&amp;#10;   ln_rounded_prem number := 0; &amp;#10;   ln_prem number := 0;&amp;#10;   ln_first_value number := 0;&amp;#10;   ln_temp number := 0;&amp;#10;   lv_temp varchar2(50); &amp;#10;begin           &amp;#10;   open  cr_round_premium ;&amp;#10;   fetch cr_round_premium into  Lv_cal_type,&amp;#10;                                Lv_round_needed,&amp;#10;                                Lv_decimal_side,&amp;#10;                                Ln_round_digits, &amp;#10;                                Lv_round_method,&amp;#10;                                Ln_round_to,&amp;#10;                                Lv_first_cut_digit_check;&amp;#10;   close    cr_round_premium; &amp;#10;   /*Round_needed = NO, then, the input value is returned back */  &amp;#10;   If lv_cal_type = 'P' then&amp;#10;&#x9;    If Lv_round_needed ='N' then&amp;#10;&#x9;    &#x9; ln_prem := p_rounded_prem;&amp;#10;&#x9;    elsif lv_round_needed = 'Y' then&amp;#10;&#x9;    &#x9; ln_rounded_prem := p_rounded_prem;&amp;#10;&#x9;       ln_first_value := p_rounded_prem;&amp;#10;         If lv_decimal_side = 'B' and lv_first_cut_digit_check = 'N' then&amp;#10;            ln_rounded_prem := floor(ln_rounded_prem);&amp;#10;            if ln_round_digits = 0 then&amp;#10;            &#x9; ln_round_digits := 1;&amp;#10;            end if;&#x9; &amp;#10;         elsif lv_decimal_side = 'A' and lv_first_cut_digit_check = 'N' then&amp;#10;&amp;#10;&#x9;     &#x9;    if floor(ln_rounded_prem) &lt;> ln_rounded_prem then&amp;#10;&#x9;     &#x9;    &#x9; lv_temp := substr(ln_rounded_prem ,instr(ln_rounded_prem ,'.',1)+1) ;  &amp;#10;&#x9;     &#x9;    &#x9; if substr(lv_temp,1,1) = 0 then&amp;#10;&#x9;     &#x9;    &#x9; &#x9;  lv_temp := 'ZERO';&amp;#10;&#x9;     &#x9;    &#x9; end if;&#x9;  &amp;#10;&#x9;&#x9;&#x9;         ln_rounded_prem:= substr(ln_rounded_prem ,instr(ln_rounded_prem ,'.',1)+1) ;  &amp;#10;&#x9;&#x9;&#x9;         ln_rounded_prem := substr(ln_rounded_prem,1,ln_round_digits);&amp;#10;&#x9;&#x9;&#x9; &#x9;    elsif floor(ln_rounded_prem) = ln_rounded_prem then    &amp;#10;&#x9;     &#x9; &#x9;     ln_rounded_prem := 0;&amp;#10;&#x9;&#x9;&#x9; &#x9;    end if;&amp;#10;&#x9;&#x9;&#x9; &#x9;    if ln_round_digits = 0 then&amp;#10;            &#x9; ln_round_digits := 1;&amp;#10;&#x9;&#x9;&#x9; &#x9;    end if;&amp;#10;&#x9;     &#x9; elsif lv_first_cut_digit_check = 'Y' and ln_round_digits = 0 then&amp;#10;&#x9;     &#x9;    ln_rounded_prem := round(ln_rounded_prem);&amp;#10;&#x9;     &#x9;    ln_prem := ln_rounded_prem;&amp;#10;&#x9;       end if;       &amp;#10;&#x9;     &amp;#10;&#x9;       if lv_decimal_side = 'A' and lv_round_method in ('F','C') and lv_first_cut_digit_check = 'N'  and Ln_round_digits &lt;> 0 then&amp;#10;&#x9;          If ln_round_to =  5  and lv_round_method = 'F' then     &amp;#10;&#x9;             if substr(ln_rounded_prem,length(ln_rounded_prem),1) >= 5  then&amp;#10;&#x9;&#x9;              ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-1)  ||'5'; &amp;#10;&#x9;             elsif substr(ln_rounded_prem,length(ln_rounded_prem),1) &lt; 5  then    &amp;#10;&#x9;       &#x9;        ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-1)  ||'0'; &amp;#10;&#x9;             end if;&#x9;  &amp;#10;&#x9;          End if;&amp;#10;&#x9;    &amp;#10;&#x9;          If ln_round_to =  5  and lv_round_method = 'C' then     &amp;#10;&#x9;             if lv_temp = 'ZERO'&#x9; then&amp;#10;&#x9;                ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-1)||'0'; &#x9;&amp;#10;&#x9;             else &amp;#10;&#x9;&#x9;&#x9;             if substr(ln_rounded_prem,length(ln_rounded_prem),1) = 0 then&amp;#10;&#x9;&#x9;&#x9;       &#x9;        ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-1)||'0'; &amp;#10;&#x9;&#x9;&#x9;             elsif substr(ln_rounded_prem,length(ln_rounded_prem),1) > 0 and&amp;#10;&#x9;&#x9;        &#x9;        substr(ln_rounded_prem,length(ln_rounded_prem),1) &lt;= 5 then&amp;#10;&#x9;&#x9;                  ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-1)||'5';&amp;#10;&#x9;&#x9;&#x9;&#x9;           elsif substr(ln_rounded_prem,length(ln_rounded_prem),1) > 5  and &amp;#10;&#x9;&#x9;&#x9;       &#x9;        substr(ln_rounded_prem,length(ln_rounded_prem),1) &lt;= 9 and&amp;#10;&#x9;&#x9;&#x9;       &#x9;        Ln_round_digits &lt;> 1 then    &amp;#10;&#x9;&#x9;&#x9;       &#x9;        ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-2)||substr(ln_rounded_prem,length(ln_rounded_prem)-1,1)+1||'0'; &amp;#10;&#x9;&#x9;&#x9;       &#x9;     elsif substr(ln_rounded_prem,length(ln_rounded_prem),1) > 5  and &amp;#10;&#x9;&#x9;&#x9;       &#x9;        substr(ln_rounded_prem,length(ln_rounded_prem),1) &lt;= 9 and&amp;#10;&#x9;&#x9;&#x9;       &#x9;        Ln_round_digits = 1 then&amp;#10;&#x9;&#x9;&#x9;       &#x9;        ln_first_value := floor(ln_first_value)+ 1;&amp;#10;&#x9;&#x9;&#x9;       &#x9;        ln_prem := 0;       &#x9;  &amp;#10;&#x9;&#x9;&#x9;       &#x9;     end if;&amp;#10;&#x9;&#x9;&#x9;       &#x9; end if;   &amp;#10;&#x9;          End if;&amp;#10;&#x9;          If ln_round_to =  0  and lv_round_method = 'F' then     &amp;#10;&#x9;             ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-1)  ||'0'; &amp;#10;&#x9;          End if;&amp;#10;&#x9;    &amp;#10;&#x9;          If ln_round_to =  0  and lv_round_method = 'C' then     &amp;#10;&#x9;             if lv_temp = 'ZERO'&#x9; then&amp;#10;&#x9;                ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-1)||'0'; &#x9;&amp;#10;&#x9;             else   &amp;#10;&#x9;&#x9;&#x9;             if substr(ln_rounded_prem,length(ln_rounded_prem),1) = 0  and ln_round_digits &lt;> 1 then&amp;#10;&#x9;&#x9;&#x9;       &#x9;        ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-1)||'0'; &amp;#10;&#x9;&#x9;&#x9;             elsif substr(ln_rounded_prem,length(ln_rounded_prem),1) > 0  and &amp;#10;&#x9;&#x9;&#x9;       &#x9;        substr(ln_rounded_prem,length(ln_rounded_prem),1) &lt;= 9 and&amp;#10;&#x9;&#x9;&#x9;       &#x9;        Ln_round_digits &lt;> 1 then    &amp;#10;&#x9;&#x9;&#x9;       &#x9;        ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-2)||substr(ln_rounded_prem,length(ln_rounded_prem)-1,1)+1||'0'; &amp;#10;&#x9;&#x9;&#x9;       &#x9;     elsif substr(ln_rounded_prem,length(ln_rounded_prem),1) > 0  and &amp;#10;&#x9;&#x9;&#x9;       &#x9;        substr(ln_rounded_prem,length(ln_rounded_prem),1) &lt;= 9 and&amp;#10;&#x9;&#x9;&#x9;       &#x9;        Ln_round_digits = 1 then&amp;#10;&#x9;&#x9;&#x9;       &#x9;        ln_first_value := floor(ln_first_value)+ 1;&amp;#10;&#x9;&#x9;&#x9;       &#x9;        ln_prem := 0;       &#x9;  &amp;#10;&#x9;&#x9;&#x9;       &#x9;     end if;&#x9;  &amp;#10;               end if;&#x9;&#x9;  &amp;#10;&#x9;          End if;&amp;#10;&#x9;          ln_prem := floor(ln_first_value)||'.'||ln_prem;&amp;#10;&#x9;       elsif lv_decimal_side = 'B' and lv_round_method in ('F','C') &amp;#10;&#x9;          and lv_first_cut_digit_check = 'N' and Ln_round_digits &lt;> 0 then&amp;#10;&#x9;          If ln_round_to =  0  and lv_round_method = 'C' then&amp;#10;         &#x9;     ln_temp := substr(ln_rounded_prem,(length(ln_rounded_prem)-ln_round_digits+1),1);&amp;#10;         &#x9;     if ln_temp >= 1 and ln_temp &lt;= 4 then&amp;#10;         &#x9;  &#x9;    ln_temp := ln_temp + 5;&amp;#10;         &#x9;     end if;&amp;#10;         &#x9;     ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)||ln_temp||substr(ln_rounded_prem,length(ln_rounded_prem)-ln_round_digits+2,ln_round_digits-1);&amp;#10;         &#x9;     ln_prem := round(ln_prem,'-'||ln_round_digits);&amp;#10;            end if;&#x9;  &amp;#10;            If ln_round_to =  0  and lv_round_method = 'F' then&amp;#10;         &#x9;     ln_temp := substr(ln_rounded_prem,(length(ln_rounded_prem)-ln_round_digits+1),1);&amp;#10;         &#x9;     if ln_temp >= 5 and ln_temp &lt;= 9 then&amp;#10;         &#x9;  &#x9;    ln_temp := ln_temp - 5;&amp;#10;         &#x9;     end if;&amp;#10;         &#x9;     ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)||ln_temp||substr(ln_rounded_prem,length(ln_rounded_prem)-ln_round_digits+2,ln_round_digits-1);&amp;#10;         &#x9;     ln_prem := round(ln_prem,'-'||ln_round_digits);&amp;#10;            end if;&amp;#10;         &amp;#10;            If ln_round_to = 5   and lv_round_method = 'C' then&amp;#10;         &#x9;     ln_temp := substr(ln_rounded_prem,(length(ln_rounded_prem)-ln_round_digits+1),1);&amp;#10;         &#x9;     if ln_temp >= 1 and ln_temp &lt;= 5 then&amp;#10;         &#x9;  &#x9;    ln_temp := 5;&amp;#10;         &#x9;  &#x9;    ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)||ln_temp;&amp;#10;         &#x9;     elsif ln_temp >= 6 and ln_temp &lt;= 9 then&amp;#10;         &#x9;  &#x9;    ln_temp := 0;&amp;#10;         &#x9;  &#x9;    ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)+1||ln_temp;&amp;#10;         &#x9;  &#x9;    if ln_prem = 0 then&amp;#10;         &#x9;  &#x9;    &#x9; ln_prem := 10;&amp;#10;         &#x9;  &#x9;    &#x9; ln_rounded_prem := ln_rounded_prem || 1;&amp;#10;         &#x9;  &#x9;    end if;&#x9; &amp;#10;         &#x9;     elsif ln_temp = 0 then&amp;#10;         &#x9;  &#x9;    ln_temp := 0;&amp;#10;         &#x9;  &#x9;    ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)||ln_temp;&amp;#10;         &#x9;     end if;&amp;#10;         &#x9;     ln_prem := rpad(ln_prem,length(ln_rounded_prem),0);&amp;#10;            end if;&amp;#10;         &amp;#10;            If ln_round_to = 5   and lv_round_method = 'F' then&amp;#10;         &#x9;     ln_temp := substr(ln_rounded_prem,(length(ln_rounded_prem)-ln_round_digits+1),1);&amp;#10;         &#x9;     if ln_temp >= 0 and ln_temp &lt;= 4 then&amp;#10;         &#x9;  &#x9;    ln_temp := 0;&amp;#10;         &#x9;  &#x9;    ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)||ln_temp;&amp;#10;         &#x9;     elsif ln_temp >= 5 and ln_temp &lt;= 9 then&amp;#10;         &#x9;  &#x9;    ln_temp := 5;&amp;#10;         &#x9;  &#x9;    ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)||ln_temp;&amp;#10;         &#x9;     end if;&#x9; &amp;#10;         &#x9;     ln_prem := rpad(ln_prem,length(ln_rounded_prem),0);&amp;#10;         &#x9;  end if;&amp;#10;         elsif lv_round_method = 'R' and ln_round_to = 0 and lv_first_cut_digit_check = 'N' then&amp;#10;      &#x9; &#x9;  if lv_decimal_side = 'A' then&amp;#10;      &#x9; &#x9;     ln_temp := nvl(substr(ln_rounded_prem,ln_round_digits,1),0);&amp;#10;      &#x9; &#x9;     if lv_temp = 'ZERO'&#x9; then&amp;#10;&#x9;                ln_prem := 0;&amp;#10;&#x9;             else&amp;#10;&#x9;&#x9;      &#x9;       if ln_temp in (0,1,2,3,4) then&amp;#10;&#x9;&#x9;      &#x9; &#x9;        ln_prem :=substr(ln_rounded_prem,1,ln_round_digits-1)||'0';&amp;#10;&#x9;&#x9;      &#x9;       elsif ln_temp in (5,6,7,8,9) and ln_round_digits &lt;> 1 then&amp;#10;&#x9;&#x9;      &#x9; &#x9;        ln_prem :=substr(ln_rounded_prem,1,ln_round_digits-1)+1||'0';&amp;#10;&#x9;&#x9;      &#x9;       elsif ln_temp in (5,6,7,8,9) and ln_round_digits =1 then   &amp;#10;&#x9;&#x9;      &#x9;       &#x9;  ln_prem := 0;&amp;#10;&#x9;&#x9;      &#x9;       &#x9;  ln_first_value := floor(ln_first_value) + 1;&amp;#10;&#x9;&#x9;      &#x9;       end if;&amp;#10;&#x9;&#x9;      &#x9;   end if;    &amp;#10;      &#x9;       ln_prem := floor(ln_first_value)||'.'||ln_prem;&amp;#10;            elsif lv_decimal_side = 'B' and ln_round_digits &lt;> 0 then&amp;#10;      &#x9;       ln_temp := substr(ln_rounded_prem,(length(ln_rounded_prem)-ln_round_digits+1),1);&#x9;&amp;#10;      &#x9;       if ln_temp in (0,1,2,3,4) then&amp;#10;      &#x9; &#x9;        ln_prem :=substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)||'0';&amp;#10;      &#x9;       elsif ln_temp in (5,6,7,8,9) and ln_round_digits &lt;> 0 then&amp;#10;      &#x9; &#x9;        ln_prem :=substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)+1||'0';&amp;#10;      &#x9; &#x9;        if ln_prem = 0 then&amp;#10;         &#x9;  &#x9;    &#x9; ln_prem := 10;&amp;#10;         &#x9;  &#x9;    &#x9; ln_rounded_prem := ln_rounded_prem || 1;&amp;#10;         &#x9;  &#x9;    end if;&#x9;&amp;#10;      &#x9;       end if;&amp;#10;      &#x9;       ln_prem := rpad(ln_prem,length(ln_rounded_prem),0);&amp;#10;      &#x9;    elsif lv_decimal_side = 'B' and ln_round_digits = 0 then&amp;#10;               ln_prem := ln_rounded_prem;&amp;#10;            end if;       &#x9; &#x9;&amp;#10;            &amp;#10;         elsif lv_round_method = 'R' and ln_round_to = 5 and lv_first_cut_digit_check = 'N' then&amp;#10;      &#x9; &#x9;  if lv_decimal_side = 'A' then&amp;#10;      &#x9; &#x9;  &#x9; if lv_temp = 'ZERO'&#x9; then&amp;#10;&#x9;                ln_prem := substr(ln_rounded_prem,1,length(ln_rounded_prem)-1)||'0'; &#x9;&amp;#10;&#x9;             else &amp;#10;&#x9;&#x9;      &#x9; &#x9;     ln_temp := nvl(substr(ln_rounded_prem,ln_round_digits,1),0);&amp;#10;&#x9;&#x9;      &#x9;       if ln_temp in (0,1,2) then&amp;#10;&#x9;&#x9;      &#x9; &#x9;        ln_prem :=substr(ln_rounded_prem,1,ln_round_digits-1)||'0';&amp;#10;&#x9;&#x9;      &#x9;       elsif ln_temp in (3,4,5,6,7) then &amp;#10;&#x9;&#x9;      &#x9; &#x9;        ln_prem :=substr(ln_rounded_prem,1,ln_round_digits-1)||'5';&amp;#10;&#x9;&#x9;      &#x9;       elsif ln_temp in (8,9) and ln_round_digits &lt;> 1 then&amp;#10;&#x9;&#x9;      &#x9; &#x9;        ln_prem :=substr(ln_rounded_prem,1,ln_round_digits-1)+1;&amp;#10;&#x9;&#x9;      &#x9; &#x9;        ln_prem := rpad(ln_prem,length(ln_prem+1),0);&amp;#10;&#x9;&#x9;      &#x9;       elsif ln_temp in (8,9) and ln_round_digits =1 then   &amp;#10;&#x9;&#x9;      &#x9;       &#x9;  ln_prem := 0;&amp;#10;&#x9;&#x9;      &#x9;       &#x9;  ln_first_value := floor(ln_first_value) + 1;&amp;#10;&#x9;&#x9;      &#x9;       end if;   &amp;#10;&#x9;&#x9;      &#x9;   end if;   &amp;#10;&#x9;&#x9;      &#x9;   ln_prem := floor(ln_first_value)||'.'||ln_prem;&amp;#10;            elsif lv_decimal_side = 'B' and ln_round_digits &lt;> 0 then&amp;#10;      &#x9;       ln_temp := substr(ln_rounded_prem,(length(ln_rounded_prem)-ln_round_digits+1),1);&#x9;&amp;#10;      &#x9;       if ln_temp in (0,1,2) then&amp;#10;      &#x9; &#x9;        ln_prem :=substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)||'0';&amp;#10;      &#x9;       elsif ln_temp in (3,4,5,6,7) then &amp;#10;      &#x9; &#x9;        ln_prem :=substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)||'5';&amp;#10;      &#x9;       elsif ln_temp in (8,9) and ln_round_digits &lt;> 0 then&amp;#10;      &#x9; &#x9;        ln_prem :=substr(ln_rounded_prem,1,length(ln_rounded_prem)-ln_round_digits)+1||'0';&amp;#10;      &#x9; &#x9;        if ln_prem = 0 then&amp;#10;         &#x9;  &#x9;    &#x9; ln_prem := 10;&amp;#10;         &#x9;  &#x9;    &#x9; ln_rounded_prem := ln_rounded_prem || 1;&amp;#10;         &#x9;  &#x9;    end if;&#x9;&amp;#10;      &#x9;       end if;&amp;#10;      &#x9;       ln_prem := rpad(ln_prem,length(ln_rounded_prem),0);&amp;#10;      &#x9;    elsif lv_decimal_side = 'B' and ln_round_digits = 0 then&amp;#10;               ln_prem := ln_rounded_prem;&amp;#10;            end if;       &#x9; &amp;#10;         End if;&amp;#10;       end if;&amp;#10;&#x9; end if;   &amp;#10;   RETURN ln_prem ;&amp;#10;End;   "/>
      <Window Name="WINDOW1" Width="360" Height="324"/>
   </FormModule>
</Module>

好的,根据我从您所说的内容中收集到的信息。这是将获取所有子项并仅提取其值的代码。它将这些值转换为添加到列表中的单个字符串。找到所有子元素后列表为return。我不知道您的编码有多流利,但这被称为递归函数。它一直调用自己,直到没有更多的工作要做。

import xml.etree.ElementTree as ET

xml_items = []

root = ET.parse('data.xml').getroot()[0]

def get_attribs(element, items=None):
    items = items if items is not None else []

    items.append(' '.join([v for v in element.attrib.values()]))

    for child in element:
        get_attribs(child, items)

    return items

get_attribs(root)

结果

['TEST true MODULE1 DEFAULT&SMARTBAR WINDOW1', '5 true Real 14 Point', 'BLOCK2 true 9 135', 'ROUND_RULE round rule 143 110 true 45 11 1 CANVAS5 14', ...]