modifying xml documents

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • e holiday

    #1

    modifying xml documents


    I have the problem of nested tables in an xml schema that I can not change

    http://www.c-sharpcorner.com/Code/20...ingDataSet.asp

    I want to modify the received xml file so that its repeated element names
    are qualified by the parent's name. I can then generate a schema from the
    first file and use the conversion process when I read the xml data from the
    data provider.

    I *believe* this will work.

    I have looked at/tried two approaches:

    - using XmlReader and XmlWriter seems laborious. I have to recreate each
    XmlNode and I have not found a simple way of doing this. The
    XmlWriter.Write Node() method would be perfect if it would take
    an XmlNode, but it does not.
    - using XmlDocument.Loa d() and XmlDocument.Sav e(). This is better because
    I have only to recreate the XmlNode whose name I want to qualify and then
    replace the original with my new node. This isn't a huge or horrible amount
    of work.

    However this second approach fails because the modification of the node
    boings the iterator. I'm getting this:

    System.InvalidO perationExcepti on: Collection was modified; enumeration
    operation may not execute.

    Tell me there is a simpler sensible way of doing this.

    I will politely withold a rant about the fact that this ludicrous procedure
    is necessary.


Working...