views:

95

answers:

1

I am planning to port my application from Windows to Linux, currently my application uses MSXML for XML parsing. I have decided to use Xerces XML parser to provide a cross platform solution. My code size is too big and I do not want to touch all the internal part of the code for this porting purpose as it might break some of the functionality. Can anybody suggest me the best way to do this.

+1  A: 

depends on what you mean with 'the internal part'; one pretty extensible way to do this would go in some steps (having tests for your application would be beneficial so you can spot when something goes wrong):

  • create an interface for all XML operations you use
  • provide an implementation of that interface that uses MSXML
  • make all your code talk to the interface instead of directly to MSXML. If you designed the interface well, this could be a matter of just a thorough find/replace, but more work might be needed
  • now everything should still be working, but with the benefit that it's seperated from the actual xml logic
  • provide another implementation for the interface, now using Xercesc
stijn
Was having something like this in mind too but was wondering if something like this is available already. But I liked your approach.
GJ
it's likely companies use systems like this, but just not as open-source.
stijn