locked
Merging 2 XML files Into 1 RRS feed

  • Question

  • Hello, I have 2 xml files that I read to file data into datatables.  I would like an easy way of moving this files to other computers. I was thinking of serilizing the two files into 1 dat file and stored in the users documents folder.   then I would need to copy that dat file to a thumb drive, take to another computer and "import" deserialize the file back into the 2 XML files for my app to read.  I am not sure which method works best or how to tell the difference between the 2 files in the dat file.  

    I am using 2015 vb.net framework 4.6.  The two files are only about 500 kb and 400 kb each.

    any suggestions or pointers would be great.

    Thursday, February 11, 2016 4:21 AM

Answers

  • Hello, I have 2 xml files that I read to file data into datatables.  I would like an easy way of moving this files to other computers. I was thinking of serilizing the two files into 1 dat file and stored in the users documents folder.   then I would need to copy that dat file to a thumb drive, take to another computer and "import" deserialize the file back into the 2 XML files for my app to read.  I am not sure which method works best or how to tell the difference between the 2 files in the dat file.  

    I am using 2015 vb.net framework 4.6.  The two files are only about 500 kb and 400 kb each.

    any suggestions or pointers would be great.

    I agree with Fouad in that you're not really gaining much by doing this, but as for "how to do it", one way that comes to mind is that you create a serializable class which has just one member: An IEnumerable(Of XElement).

    In the class's constructor, you then take in the parameters passed in and create the IEnumerable, then set up a "Save" and a "Load" method.

    Present the IEnumerable as a read-only property and you should then be set.


    Knowledge rests not upon truth alone, but upon error also. Carl Jung

    Thursday, February 11, 2016 8:13 PM

All replies

  • I'm not seeing any point in merging the two files into one and then back to two, also the way you moving the files is manual so whether its 1 or 2 doesn't matter IMO.

    Fouad Roumieh

    Thursday, February 11, 2016 6:34 AM
  • Hello, I have 2 xml files that I read to file data into datatables.  I would like an easy way of moving this files to other computers. I was thinking of serilizing the two files into 1 dat file and stored in the users documents folder.   then I would need to copy that dat file to a thumb drive, take to another computer and "import" deserialize the file back into the 2 XML files for my app to read.  I am not sure which method works best or how to tell the difference between the 2 files in the dat file.  

    I am using 2015 vb.net framework 4.6.  The two files are only about 500 kb and 400 kb each.

    any suggestions or pointers would be great.

    I agree with Fouad in that you're not really gaining much by doing this, but as for "how to do it", one way that comes to mind is that you create a serializable class which has just one member: An IEnumerable(Of XElement).

    In the class's constructor, you then take in the parameters passed in and create the IEnumerable, then set up a "Save" and a "Load" method.

    Present the IEnumerable as a read-only property and you should then be set.


    Knowledge rests not upon truth alone, but upon error also. Carl Jung

    Thursday, February 11, 2016 8:13 PM