大唐电信笔试上机题(关于SAX解析XML的)大家试试!

07-08-02 kobewadesnow

用SAX解析下列XML:

<?xml version="1.0"?>
<in>
<sheader>
<mac></mac>
<MACInstNo>9850</MACInstNo>
<PINSeed></PINSeed>
<SrcChnlNo>850</SrcChnlNo>
<ChkFlag></ChkFlag>
<CombFlag></CombFlag>
<HostServ>waiwei_02</HostServ>
</sheader>
<tpheader>
<TermId></TermId>
<InstNo>3500</InstNo>
<TlrNo>901004</TlrNo>
</tpheader>
<tdheader>
<TranCode>7703</TranCode>
<TermJourNo>000850326665</TermJourNo>
<TermDate>20070706</TermDate>
<AuthTlrNo></AuthTlrNo>
<AuthPIN></AuthPIN>
<AuthCardFlag></AuthCardFlag>
<AuthCardSeq></AuthCardSeq>
</tdheader>
<tin>
<Type>1</Type>
<mobileNum>123456</mobileNum>
<Mode>1</Mode>
</tin>
</in>
解析结果为一个Map,key是xml中元素的全路径,value是元素的值,例如:
in.sheader.MACInstNo = 9850