开发者

Encrypting XML Element

开发者 https://www.devze.com 2022-12-22 03:03 出处:网络
I have created XML file called users.xml Looks like this: <Users> <user> <uin>\"0012345\"</uin>

I have created XML file called users.xml Looks like this:

<Users>
  <user>
    <uin>"0012345"</uin>
    <name>black</name>
    <email>"bk@hotemail.com"</email>
    <created>"3/02/2010"</created>
  </user>
  <user>
    <uin>"123456780"</uin>
    <n开发者_运维技巧ame>sam</name>
    <email>"sam@hotmail.com"</email>
    <created>"3/02/2010"</created>
  </user>
  <user>
    <uin>"123456799"</uin>
    <name>kblack</name>
    <email>"kblack@hotmail.com"</email>
    <created>"3/02/2010"</created>
  </user>
</Users>

I want to encrypt the element. Using code like

XmlElement uinelement = (XmlElement)xmldoc.SelectSingleNode("Users/user/uin");

...encrypts only first UIN from the user.xml file.

How can I Encrypt all UIN elements?

Thank you

Kanta


It looks like your xml was not correctly encoded, so I can't see your document structure, however I would guess that using the SelectNodes() method of the XmlDocument class instead of SelectSingleNode() would do the trick.

You may also want to look at some of the Linq to XML capabilities if you need to output the transformation to a new XML doc.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号