Hi, Ignorant .Net Newbie Here -
I'm loading up an XML document and trying to encrypt some elements but not
others, by iterating through the nodelist returned from
XmlDocument.GetElementsByName(). Goofy things happen. I get back 8
elements, but as I step through the nodes, encrypting and calling
EncryptedXml.ReplaseData(), I end up with several of the elements turning
into null.
I started by treating the nodelist as an array, and using
for(int i = 0, j = nodelist.Count; i<j; i++)
Next I tried using the iterator that comes back from nodelist.GetEnumerator.
That blew up as soon as I modified the nodelist - according to the docs
(which I should have read first) you can't mess around with the underlying
collection once you have an iterator to it.
I can just encrypt the whole XML file, but I'd kind of like to know how to
do this. Do I need to build a new XmlDocument in memory, merging the
plaintext elements from the original XmlDocument with the ciphertext ones
that I create with the EncryptedXml class?