Migration from MSXML to Xerces
I am planning to port my application from Windows to Linux, curren开发者_运维技巧tly 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.
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
精彩评论