本文介绍了使用C#读取Xml节点名称和值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

- < taxpayerdetails>



< TFN Tag =^ AAD> 1947



< Title Tag =^ ABE> MR



< GivenName Tag =^ ABG> MAHESH



< MiddleName Tag =^ BBB>



< FamilyName Tag =^ ABF > SHARMA



< Suffix Tag =^ BAW/>



< ResidencyStatus Tag =^ AJY> N



< ResidencyStatusDate Tag => 2017-10-31



- < postaladdress>



< Line1 Tag =^ ABH> ABC



< Line2 Tag =^ ABH> GPO



< Suburb Tag =^ AME> DELHI



< State Tag =^ AMF> DELHI



< PostCode Tag =^ APE> 20







< DateOfBirth Tag =^ ABQ> 1974-12-30



- < contactphone>



< AreaCode Tag =^ BOC> 07



& LT; PhoneNo Tag =^ BOD> 55123











- < paygpaymentsummaries>



< mostrecentpaygupdatedate> 2017-06-30



- < individualnonbusinesspaymentsummary>



- < individualnonbusinesspaymentsummarytype>



< LastUpdatedTimestamp标签=> 2017-06-30















我的尝试:



我无法提取这些标签值和标签名称

喜欢



tagname = GivenName

tagvalue = MAHESH

解决方案

-<taxpayerdetails>

<TFN Tag="^AAD">1947

<Title Tag="^ABE">MR

<GivenName Tag="^ABG">MAHESH

<MiddleName Tag="^BBB">

<FamilyName Tag="^ABF">SHARMA

<Suffix Tag="^BAW"/>

<ResidencyStatus Tag="^AJY">N

<ResidencyStatusDate Tag="">2017-10-31

-<postaladdress>

<Line1 Tag="^ABH">ABC

<Line2 Tag="^ABH">GPO

<Suburb Tag="^AME">DELHI

<State Tag="^AMF">DELHI

<PostCode Tag="^APE">20



<DateOfBirth Tag="^ABQ">1974-12-30

-<contactphone>

<AreaCode Tag="^BOC">07

<PhoneNo Tag="^BOD">55123





-<paygpaymentsummaries>

<mostrecentpaygupdatedate>2017-06-30

-<individualnonbusinesspaymentsummary>

-<individualnonbusinesspaymentsummarytype>

<LastUpdatedTimestamp Tag="">2017-06-30







What I have tried:

I am not able to extract these tag value and tag name
like

tagname = GivenName
tagvalue = MAHESH

解决方案


这篇关于使用C#读取Xml节点名称和值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 22:09