• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

1C#将xml文档的节点转换成大写的形式

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

1 例如有xml文档

  

<?xml version="1.0" encoding="utf-8"?>
<EDISecurityMaster593Entity>
<SCEXHID position="0" type="int">the field ScexhIDlength more than max length</SCEXHID>
<SEDOLID position="1" type="int">the field SedolIDlength more than max length</SEDOLID>
<ACTFLAG position="2" maxlength="1" type="string">the field Actflaglength more than max length 1.</ACTFLAG>
<CHANGED position="3" maxlength="" type="datetime">the field Changedlength more than max length</CHANGED>
<CREATED position="4" maxlength="" type="datetime">the field Createdlength more than max length</CREATED>
<SECID position="5" type="int">the field SecIDlength more than max length</SECID>
<ISSID position="6" type="int">the field IssIDlength more than max length</ISSID>
<ISIN position="7" maxlength="12" type="string">the field ISINlength more than max length 12.</ISIN>
<USCODE position="8" maxlength="9" type="string">the field USCodelength more than max length 9.</USCODE>
<ISSUERNAME position="9" maxlength="70" type="string">the field IssuerNamelength more than max length 70.</ISSUERNAME>
<CNTRYOFINCORP position="10" maxlength="2" type="string">the field CntryofIncorplength more than max length 2.</CNTRYOFINCORP>
<SIC position="11" maxlength="10" type="string">the field SIClength more than max length 10.</SIC>
<CIK position="12" maxlength="10" type="string">the field CIKlength more than max length 10.</CIK>
<INDUSID position="13" type="int">the field IndusIDlength more than max length</INDUSID>
<SECTYCD position="14" maxlength="3" type="string">the field SectyCDlength more than max length 3.</SECTYCD>
<SECURITYDESC position="15" maxlength="70" type="string">the field SecurityDesclength more than max length 70.</SECURITYDESC>
<PARVALUE position="16" maxlength="" type="decimal">the field ParValuelength more than max length</PARVALUE>
<PVCURRENCY position="17" maxlength="3" type="string">the field PVCurrencylength more than max length 3.</PVCURRENCY>
<STATUSFLAG position="18" maxlength="1" type="string">the field StatusFlaglength more than max length 1.</STATUSFLAG>
<PRIMARYEXCHGCD position="19" maxlength="6" type="string">the field PrimaryExchgCDlength more than max length</PRIMARYEXCHGCD>
<SEDOL position="20" maxlength="7" type="string">the field Sedollength more than max length</SEDOL>
<SEDOLCURRENCY position="21" maxlength="2" type="string">the field SedolCurrencylength more than max length 3.</SEDOLCURRENCY>
<DEFUNCT position="22" maxlength="1" type="string">the field Defunctlength more than max length 1.</DEFUNCT>
<SEDOLREGCNTRY position="23" maxlength="2" type="string">the field Sedolregcntrylength more than max length 2.</SEDOLREGCNTRY>
<STRUCTCD position="24" maxlength="10" type="string">the field StructCDlength more than max length 10.</STRUCTCD>
<EXCHGCNTRY position="25" maxlength="2" type="string">the field ExchgCntrylength more than max length 2.</EXCHGCNTRY>
<EXCHGCD position="26" maxlength="6" type="string">the field ExchgCDlength more than max length 6.</EXCHGCD>
<MIC position="27" maxlength="4" type="string">the field Miclength more than max length 4.</MIC>
<MICSEG position="28" maxlength="4" type="string">the field Micseglength more than max length 4.</MICSEG>
<LOCALCODE position="29" maxlength="50" type="string">the field LocalCodelength more than max length 50.</LOCALCODE>
<LISTSTATUS position="30" maxlength="1" type="string">the field ListStatuslength more than max length 1.</LISTSTATUS>
<LISTDATE position="31" maxlength="" type="datetime">the field Changedlength more than max length</LISTDATE>
<CFI position="32" maxlength="10" type="datetime">the field Changedlength more than max length 10.</CFI>
</EDISecurityMaster593Entity>

2 转换方法为

XElement xel = XElement.Load("..//..//xml//EDICorporateActionRawEntity.xml");
for (int i = 0; i < xel.Elements().Count(); i++)
{
string name = xel.Elements().ElementAt(i).Name.LocalName;
xel.Elements().ElementAt(i).Name = name.ToUpper();
xel.Save("..//..//xml//EDICorporateActionRawEntity.xml");
}


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
分享通用基类库-C#通用字符串处理类发布时间:2022-07-10
下一篇:
C#中控件的Focus()和GotFocus()的区别?发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap