0

my concern is that, im trying to make a program that will show up let's say images of cars to create a collection. I'm using windows forms and i have made the grapchical interface i want. The thing is i have a xml file (like database) with 300 cars(elements) and each car has a some children elements one of them being the "carname.png" so i can use it to find the file image to show also. My concern here is if there is a way to convert this xml file into a binary one that my program will be able to read much faster. This is for efficiency and self-educational-practice purposes as I am young in programming. Thanx in advance for your time and thoughts.

Shiroe
  • 65
  • 1
  • 1
  • 10
  • Have a read of this http://social.msdn.microsoft.com/forums/vstudio/en-US/3fc0053c-c919-4956-93a6-0df3115459ec/how-to-convert-xml-to-binary – Savlon Aug 17 '14 at 01:04
  • I tried this link and got me nowhere, i tried something like BinaryWriter and xml convertion with some methods i found like ToByte() but couldnt do anything :// – Shiroe Aug 17 '14 at 01:55
  • Since you have a working program, you need to instrument the code to determine where the actual bottlenecks are. Once you have determined what needs to be improved, then you can work on, and measure, that part of the code. Sometimes the problem is purely a matter of CPU time, others are high memory usage, excessive I/O bandwidth, network delays, ... . – HABO Aug 17 '14 at 03:07
  • If you are returning the 300 cars details in one xml file, that's fine but if you have the filename specified in the xml, why not just request the image of the car when required (on demand?). You definitely don't want to return all images at once!! – Thierry Aug 17 '14 at 05:17

1 Answers1

1

Simply import your XML file into a suitable database and query that instead. If it naturally fits into relational form, use Sqlite as first choice. In the Windows environment as a learning experience you might prefer to use SqlServer but it's overkill.

If the data does not fit naturally into the relational form then use a no-sql database like MongoDB and store your XML records (or JSON or whatever) in it. You get fast access and XML flexibility together.

david.pfx
  • 10,520
  • 3
  • 30
  • 63