使用JavaScript解析XML文件

2,151 阅读1分钟

使用JavaScript的方式去解析xml文件

xml文件内容: 

<?xml version="1.0" encoding="gb2312"?>
<interface name="0101" type="interface" title="0101-Current account opening-活期开户" align="0" left="10" top="10" height="578" width="824" background="#b4b4b4" foreground="#000000" fontname="宋体" fontstyle="0" fontsize="14" allowscrollbar="true" showtitle="true" defaultfocused="false" sendthedata="false" enabled="true" tranid="" triggerif="">
  <basic-info>
    <name>int_0101.ui</name>
    <author />
    <date>2012/03/12 11:51:40</date>
    <modifier />
    <modifyDate>2019/10/16 16:32:56</modifyDate>
  </basic-info>
  <form>
    <input type="text" name="cstm_no" namespace="" oldid="cstm_no" ctrldesc="客户号" align="0" alignindex="-1" left="188" top="28" height="22" width="149" verfiyprocess="" autoupdatesize="false" help="" background="#ffafaf" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="true" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="14" tipmessage="" maxlength="14" formater="com.nantian.abs40.text.formater.FormatNumber" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="true" autotransferfocus="false" editable="false" checkable="false" doubleinput="false" downlink="true">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnExit" function="cstm_no_OnExit" />
      </events>
    </input>
    <label name="jGLabel0" namespace="" oldid="jGLabel0" ctrldesc="" align="0" alignindex="-1" left="65" top="29" height="20" width="114" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Customer No-客户号" icon="" iconfilepath="" downlink="true" />
    <input type="text" name="cstm_name" namespace="" oldid="cstm_name" ctrldesc="户名" align="0" alignindex="-1" left="188" top="57" height="22" width="577" verfiyprocess="" autoupdatesize="false" help="" background="#ffffff" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="2" tipmessage="" maxlength="300" formater="actUnlimit" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="false" autotransferfocus="false" editable="false" checkable="false" doubleinput="false" downlink="true" />
    <label name="jGLabel1" namespace="" oldid="jGLabel1" ctrldesc="" align="0" alignindex="-1" left="59" top="58" height="20" width="120" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Customer Name-户名" icon="" iconfilepath="" downlink="true" />
    <filterlist name="paper_type" namespace="" oldid="paper_type" ctrldesc="证件类型" align="0" alignindex="-1" left="188" top="86" height="22" width="150" verfiyprocess="" autoupdatesize="false" help="" background="#ffafaf" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="false" visible="true" prtscmask="false" popupmode="true" outputprocess="" datasourcetype="1" dynamicconf="com.nantian.abs40.transaction.menu.paper_type.xml" affection="" trancode="" parsevarname="" sqlwhere="" datasourcehandleclass="" defaultvalue="" needvalue="true" fuzzymatch="false" editable="false" downlink="false">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnSelectionChanged" function="paper_type_OnSelectionChanged" />
      </events>
    </filterlist>
    <input type="text" name="paper_no" namespace="" oldid="paper_no" ctrldesc="证件号码" align="0" alignindex="-1" left="524" top="86" height="22" width="241" verfiyprocess="" autoupdatesize="false" help="" background="#ffafaf" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="24" formater="actUnlimit" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="true" autotransferfocus="false" editable="false" checkable="false" doubleinput="false" downlink="true">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnVailidate" function="paper_no_OnVailidate" />
      </events>
    </input>
    <label name="jGLabel2" namespace="" oldid="jGLabel2" ctrldesc="" align="0" alignindex="-1" left="65" top="87" height="20" width="114" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Paper Type-证件类型" icon="" iconfilepath="" downlink="true" />
    <label name="jGLabel3" namespace="" oldid="jGLabel3" ctrldesc="" align="0" alignindex="-1" left="409" top="87" height="20" width="104" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Paper No-证件号码" icon="" iconfilepath="" downlink="true" />
    <input type="text" name="phone" namespace="" oldid="phone" ctrldesc="" align="0" alignindex="-1" left="564" top="114" height="22" width="109" verfiyprocess="" autoupdatesize="false" help="" background="#ffffff" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="17" formater="com.nantian.abs40.text.formater.FormatNumber" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="false" autotransferfocus="false" editable="true" checkable="false" doubleinput="false" downlink="true" />
    <input type="text" name="addr" namespace="" oldid="addr" ctrldesc="" align="0" alignindex="-1" left="188" top="115" height="22" width="228" verfiyprocess="" autoupdatesize="false" help="" background="#ffffff" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="33" formater="actUnlimit" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="false" autotransferfocus="false" editable="true" checkable="false" doubleinput="false" downlink="true" />
    <label name="jGLabel4" namespace="" oldid="jGLabel4" ctrldesc="" align="0" alignindex="-1" left="105" top="116" height="20" width="74" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Address-地址" icon="" iconfilepath="" downlink="true" />
    <label name="jGLabel5" namespace="" oldid="jGLabel5" ctrldesc="" align="0" alignindex="-1" left="438" top="116" height="20" width="111" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Telephone-联系电话" icon="" iconfilepath="" downlink="true" />
    <filterlist name="curr_type" namespace="" oldid="curr_type" ctrldesc="币    种" align="0" alignindex="-1" left="189" top="144" height="22" width="118" verfiyprocess="" autoupdatesize="false" help="" background="#ffafaf" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" popupmode="true" outputprocess="" datasourcetype="0" dynamicconf="" affection="" trancode="" parsevarname="" sqlwhere="" datasourcehandleclass="" defaultvalue="" needvalue="true" fuzzymatch="false" editable="false" downlink="false">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnSelectionChanged" function="curr_type_OnSelectionChanged" />
      </events>
    </filterlist>
    <label name="jGLabel8" namespace="" oldid="jGLabel8" ctrldesc="" align="0" alignindex="-1" left="102" top="145" height="20" width="77" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Currency-币种" icon="" iconfilepath="" downlink="true" />
    <filterlist name="acc_flag" namespace="" oldid="acc_flag" ctrldesc="帐户属性" align="0" alignindex="-1" left="189" top="173" height="22" width="204" verfiyprocess="" autoupdatesize="false" help="" background="#ffafaf" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" popupmode="true" outputprocess="" datasourcetype="1" dynamicconf="com.nantian.abs40.transaction.menu.MACCFLAG.xml" affection="" trancode="" parsevarname="" sqlwhere="" datasourcehandleclass="" defaultvalue="" needvalue="true" fuzzymatch="false" editable="true" downlink="true">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnExit" function="acc_flag_OnExit" />
      </events>
    </filterlist>
    <label name="jGLabel7" namespace="" oldid="jGLabel7" ctrldesc="" align="0" alignindex="-1" left="36" top="174" height="20" width="143" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Account Property-帐户属性" icon="" iconfilepath="" downlink="true" />
    <filterlist name="prd_no" namespace="" oldid="prd_no" ctrldesc="产品号" align="0" alignindex="-1" left="189" top="202" height="22" width="349" verfiyprocess="" autoupdatesize="false" help="" background="#d4d0c8" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" popupmode="true" outputprocess="" datasourcetype="0" dynamicconf="" affection="" trancode="" parsevarname="" sqlwhere="" datasourcehandleclass="" defaultvalue="" needvalue="true" fuzzymatch="false" editable="true" downlink="true" />
    <label name="jGLabel6" namespace="" oldid="jGLabel6" ctrldesc="" align="0" alignindex="-1" left="78" top="203" height="20" width="101" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Product No-产品号" icon="" iconfilepath="" downlink="true" />
    <input type="text" name="nat" namespace="" oldid="nat" ctrldesc="冠字号" align="0" alignindex="-1" left="188" top="231" height="22" width="48" verfiyprocess="" autoupdatesize="false" help="" background="#ffafaf" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="4" formater="com.nantian.abs40.text.formater.FormatNumber" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="true" autotransferfocus="false" editable="true" checkable="false" doubleinput="false" downlink="true" />
    <input type="text" name="psbk_no" namespace="" oldid="psbk_no" ctrldesc="存折/存单号码" align="0" alignindex="-1" left="432" top="231" height="22" width="108" verfiyprocess="" autoupdatesize="false" help="" background="#ffafaf" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="9" formater="com.nantian.abs40.text.formater.FormatNumber" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="true" autotransferfocus="false" editable="true" checkable="false" doubleinput="false" downlink="true" />
    <label name="jGLabel9" namespace="" oldid="jGLabel9" ctrldesc="" align="0" alignindex="-1" left="75" top="232" height="20" width="104" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Prefix Letter-冠字号" icon="" iconfilepath="" downlink="true" />
    <label name="jGLabel10" namespace="" oldid="jGLabel10" ctrldesc="" align="0" alignindex="-1" left="273" top="232" height="20" width="154" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Passbook No-存折/存单号码" icon="" iconfilepath="" downlink="true" />
    <input type="text" name="amt" namespace="" oldid="amt" ctrldesc="开户金额" align="0" alignindex="-1" left="188" top="260" height="22" width="150" verfiyprocess="" autoupdatesize="false" help="" background="#ffafaf" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="16" formater="actAmount" textalign="alRight" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="true" currencysource="" needvalue="true" autotransferfocus="false" editable="true" checkable="false" doubleinput="false" downlink="true">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnEnter" function="amt_OnEnter" />
      </events>
    </input>
    <label name="jGLabel11" namespace="" oldid="jGLabel11" ctrldesc="" align="0" alignindex="-1" left="35" top="261" height="20" width="144" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Opening Amount-开户金额" icon="" iconfilepath="" downlink="true" />
    <filterlist name="csh_tsf_flag" namespace="" oldid="csh_tsf_flag" ctrldesc="" align="0" alignindex="-1" left="188" top="289" height="22" width="118" verfiyprocess="" autoupdatesize="false" help="" background="#ffafaf" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" popupmode="true" outputprocess="" datasourcetype="1" dynamicconf="com.nantian.abs40.transaction.menu.csh_tsf_flag.xml" affection="" trancode="" parsevarname="" sqlwhere="" datasourcehandleclass="" defaultvalue="" needvalue="true" fuzzymatch="false" editable="true" downlink="true">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnSelectionChanged" function="csh_tsf_flag_OnSelectionChanged" />
      </events>
    </filterlist>
    <input type="text" name="acc_other" namespace="" oldid="acc_other" ctrldesc="" align="0" alignindex="-1" left="498" top="289" height="22" width="201" verfiyprocess="" autoupdatesize="false" help="" background="#ffffff" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="25" formater="com.nantian.abs40.text.formater.FormatNumber" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="false" autotransferfocus="false" editable="true" checkable="false" doubleinput="false" downlink="true" />
    <label name="jGLabel12" namespace="" oldid="jGLabel12" ctrldesc="" align="0" alignindex="-1" left="7" top="290" height="20" width="172" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Cash or Transfer Flag-现转标志" icon="" iconfilepath="" downlink="true" />
    <label name="jGLabel13" namespace="" oldid="jGLabel13" ctrldesc="" align="0" alignindex="-1" left="336" top="290" height="20" width="152" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Target Account No-对方帐号" icon="" iconfilepath="" downlink="true" />
    <filterlist name="csh_anal_code" namespace="" oldid="csh_anal_code" ctrldesc="" align="0" alignindex="-1" left="188" top="318" height="22" width="510" verfiyprocess="" autoupdatesize="false" help="" background="#ffafaf" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" popupmode="true" outputprocess="" datasourcetype="0" dynamicconf="" affection="" trancode="" parsevarname="" sqlwhere="" datasourcehandleclass="" defaultvalue="" needvalue="true" fuzzymatch="false" editable="true" downlink="true" />
    <label name="jGLabel14" namespace="" oldid="jGLabel14" ctrldesc="" align="0" alignindex="-1" left="3" top="319" height="20" width="176" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Cash Analysis Code-现金分析码" icon="" iconfilepath="" downlink="true" />
    <filterlist name="draw_type" namespace="" oldid="draw_type" ctrldesc="支取方式" align="0" alignindex="-1" left="188" top="347" height="22" width="175" verfiyprocess="" autoupdatesize="false" help="" background="#d4d0c8" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" popupmode="true" outputprocess="" datasourcetype="1" dynamicconf="com.nantian.abs40.transaction.menu.draw_type.xml" affection="" trancode="" parsevarname="" sqlwhere="" datasourcehandleclass="" defaultvalue="" needvalue="true" fuzzymatch="false" editable="true" downlink="true">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnSelectionChanged" function="draw_type_OnSelectionChanged" />
      </events>
    </filterlist>
    <input type="password" name="pwd_other" namespace="" oldid="pwd_other" ctrldesc="" align="0" alignindex="-1" left="529" top="347" height="22" width="100" verfiyprocess="" autoupdatesize="false" help="" background="#f0f0f0" foreground="#000000" fontname="微软雅黑" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="true" enabled="false" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="6" formater="com.nantian.abs40.text.formater.FormatNumber" pinencode="0" acctname="" acctnamespace="" outputprocess="com.nantian.abs40.transaction.TlrEncrpt.encrpt_acc" sensitivedata="false" needvalue="false" autotransferfocus="false" editable="false" checkable="false" doubleinput="false" downlink="true">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnEnter" function="pwd_other_OnEnter" />
      </events>
    </input>
    <label name="jGLabel15" namespace="" oldid="jGLabel15" ctrldesc="" align="0" alignindex="-1" left="69" top="348" height="20" width="110" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Draw Type-支取方式" icon="" iconfilepath="" downlink="true" />
    <label name="jGLabel16" namespace="" oldid="jGLabel16" ctrldesc="" align="0" alignindex="-1" left="434" top="348" height="20" width="84" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Password-密码" icon="" iconfilepath="" downlink="true" />
    <filterlist name="fc_fe_flag" namespace="" oldid="fc_fe_flag" ctrldesc="钞汇标志" align="0" alignindex="-1" left="188" top="376" height="22" width="175" verfiyprocess="" autoupdatesize="false" help="" background="#d4d0c8" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" popupmode="true" outputprocess="" datasourcetype="1" dynamicconf="com.nantian.abs40.transaction.menu.MFCFE.xml" affection="" trancode="" parsevarname="" sqlwhere="" datasourcehandleclass="" defaultvalue="" needvalue="false" fuzzymatch="false" editable="true" downlink="true" />
    <input type="text" name="norm_fratio" namespace="" oldid="norm_fratio" ctrldesc="" align="0" alignindex="-1" left="566" top="376" height="22" width="138" verfiyprocess="" autoupdatesize="false" help="" background="#ffffff" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="0.000000" minlength="0" tipmessage="" maxlength="16" formater="com.nantian.abs40.text.formater.FormatDecimal" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="true" currencysource="" needvalue="false" autotransferfocus="false" editable="true" checkable="false" doubleinput="false" downlink="true" />
    <label name="jGLabel17" namespace="" oldid="jGLabel17" ctrldesc="" align="0" alignindex="-1" left="75" top="377" height="20" width="104" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Banknote-钞汇标志" icon="" iconfilepath="" downlink="true" />
    <label name="jGLabel18" namespace="" oldid="jGLabel18" ctrldesc="" align="0" alignindex="-1" left="379" top="377" height="20" width="176" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Normal Float Rate-正常浮动比例" icon="" iconfilepath="" downlink="true" />
    <label name="jGLabel19" namespace="" oldid="jGLabel19" ctrldesc="" align="0" alignindex="-1" left="17" top="408" height="21" width="744" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" icon="" iconfilepath="" downlink="true" />
    <input type="text" name="acc" namespace="" oldid="acc" ctrldesc="" align="0" alignindex="-1" left="188" top="435" height="22" width="200" verfiyprocess="" autoupdatesize="false" help="" background="#f0f0f0" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="30" formater="com.nantian.abs40.text.formater.FormatNumber" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="false" autotransferfocus="false" editable="false" checkable="false" doubleinput="false" downlink="true" />
    <input type="text" name="acc_id" namespace="" oldid="acc_id" ctrldesc="" align="0" alignindex="-1" left="537" top="435" height="22" width="49" verfiyprocess="" autoupdatesize="false" help="" background="#f0f0f0" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="3" formater="com.nantian.abs40.text.formater.FormatNumber" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="false" autotransferfocus="false" editable="false" checkable="false" doubleinput="false" downlink="true" />
    <label name="jGLabel20" namespace="" oldid="jGLabel20" ctrldesc="" align="0" alignindex="-1" left="89" top="436" height="20" width="90" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Account No-帐号" icon="" iconfilepath="" downlink="true" />
    <label name="jGLabel21" namespace="" oldid="jGLabel21" ctrldesc="" align="0" alignindex="-1" left="402" top="436" height="20" width="110" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Account ID-帐户ID号" icon="" iconfilepath="" downlink="true" />
    <input type="text" name="bal" namespace="" oldid="bal" ctrldesc="" align="0" alignindex="-1" left="188" top="464" height="22" width="150" verfiyprocess="" autoupdatesize="false" help="" background="#f0f0f0" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="19" formater="actAmount" textalign="alRight" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="true" currencysource="" needvalue="false" autotransferfocus="false" editable="false" checkable="false" doubleinput="false" downlink="true" />
    <label name="jGLabel22" namespace="" oldid="jGLabel22" ctrldesc="" align="0" alignindex="-1" left="106" top="465" height="20" width="73" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Balance-余额" icon="" iconfilepath="" downlink="true" />
    <input type="text" name="clt_seqno" namespace="" oldid="clt_seqno" ctrldesc="" align="0" alignindex="-1" left="188" top="493" height="22" width="150" verfiyprocess="" autoupdatesize="false" help="" background="#f0f0f0" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="13" defaultfocused="false" sendthedata="true" enabled="true" visible="true" prtscmask="false" text="" minlength="0" tipmessage="" maxlength="10" formater="actUnlimit" textalign="alLeft" outputprocess="" iscurrencysrc="false" start="" length="" sensitivedata="false" amountfield="false" currencysource="" needvalue="false" autotransferfocus="false" editable="false" checkable="false" doubleinput="false" downlink="true" />
    <label name="jGLabel23" namespace="" oldid="jGLabel23" ctrldesc="" align="0" alignindex="-1" left="42" top="494" height="20" width="137" verfiyprocess="" autoupdatesize="true" help="" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Teller Serial No-柜员流水" icon="" iconfilepath="" downlink="true" />
    <button name="jGButton_submit" namespace="" oldid="jGButton_submit" ctrldesc="" align="0" alignindex="-1" left="208" top="537" height="22" width="117" verfiyprocess="" autoupdatesize="true" help="提交" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Submit-提交" icon="" iconfilepath="" defaultbutton="false" toolbarmode="false">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnClicked" function="jGButton_submit_OnClicked" />
      </events>
    </button>
    <button name="jGButton_close" namespace="" oldid="jGButton_close" ctrldesc="" align="0" alignindex="-1" left="457" top="537" height="22" width="100" verfiyprocess="" autoupdatesize="true" help="关闭" background="#b4b4b4" foreground="#000000" fontname="Dialog.plain" fontstyle="0" fontsize="12" defaultfocused="false" sendthedata="false" enabled="true" visible="true" prtscmask="false" text="Close-关闭" icon="" iconfilepath="" defaultbutton="false" toolbarmode="false">
      <events class="abs01/com.nantian.abs40.transaction.typical.T0101.T0101$UIint_0101">
        <event name="OnClicked" function="jGButton_close_OnClicked" />
      </events>
    </button>
  </form>
</interface>

JavaScript代码:

使用递归的方法去解析xml文件

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<script type="text/javascript">
			
			xhttp=new XMLHttpRequest();   //读取xml文件
			xhttp.open("GET","./source/int_0101.xml",false);
			xhttp.send();
			xmlDoc=xhttp.responseXML;
			
			var root=xmlDoc.documentElement;        //获取根节点
			console.log(root)
//			console.log(root.nodeType)
//			console.log(root.children[0].nodeName)
			for (var i = 0; i < root.children.length; i++) {
				if(root.children[i].hasChildNodes()){
					document.write(root.children[i].nodeName+":<br />");
					
					var x = root.children[i];
					console.log(x)
//					console.log(x.attributes)
					var len = x.attributes.length;
					console.log(len)
					if(len>0){
						for(var i=0;i<len;i++){
						    var it = x.attributes[i];
//						    console.log(x.attributes[i])
						    //属性名
						    var localName = it.localName;
						    //属性值
						    var value = it.value;
						    document.write("属性名:"+localName+"==属性值:"+value+'<br />');
						}
					}
					
					
					Recursion(x);
				}else{
					document.write(root.children[i].nodeName+"<br />");
				}
                
            }
			var k = 0;
			function Recursion(item) {

	            if (item.children.length > 0) {
					
	                for (var i = 0; i < item.children.length; i++) {
	                	document.write(item.children[i].nodeName+"---<br />");
						len = item.children[i].attributes.length;

						if(len != 0){
							for(var j=0;j<len;j++){
								it = item.children[i].attributes[j];
//							    console.log(it)
							    var localName = it.localName;
							    var value = it.value;
							    document.write("属性名:"+localName+"==属性值:"+value+'<br />');
							}
						}
						

	                    
	                    if (item.children[i].hasChildNodes()) {  //判断一个节点是否含有子节点
	                        Recursion(item.children[i]);  
	                    }
	                }
	            
	            }
	        }
		</script>
	</body>
</html>

在网页中显示xml文件的解析结果