I am merging several XML files together, and you need to take specific children from each XML document and put them in the third. And this is normal, but the problem is that then my "child" nodes are in a somewhat random order (well, what I selected from the first file, followed by what I selected from the second), and the schema file (.xsd) defines these children as a "sequence" or xs:sequence, if you prefer. Thus, the output file no longer passes the test, because when each file has its elements in order, the resulting file does not.
I am wondering, since I have a .xsd, and I have a "basically" valid .xml file, is there a way in C # to "move" all the nodes in the correct order according to the order defined in .xsd, without a big pain? Obviously, I could implement some sort of sorting, but I hope something is built in there. Or better yet, an inline merge that does this automatically can also work.
Any ideas?
source
share