I'm trying out OmniXML after years of working with the default msxml implementation. I have several xml structures (some of which are pretty massive) for which I originally created a binding using the Delphi wizard. The binding was then edited manually to fix errors and what not.
First question: is there a (somewhat) easy way to create such a binding for OmniXML? I suspect not, but you never know... I started editing my structures by hand to try and make the interfaces and classes fit into omniXML, but it is quite a bit of (very tedious) work
Second question: In some of the demos, and online, it would seem that the "data binding" (for want of a better term) is done by inheriting the classes defined in OmniXMLPorperties (TGpXMLxxxx). So I started toying with that. Is there an advantage, at least in my case, to defining my data-binding this way as opposed to trying to recycle the one created by the wizard?
Thanks!
PS: In case it matters, I'm using Delphi XE2
Delphi's native XML Data Binding is not tied to any particular XML DOM vendor implementation. It is based on TXMLDocument
and related interfaces, which then access vendor-specific DOM interfaces internally.
On Windows, MSXML is the default DOM vendor used. On Mac OSX, ADOM/OpenXML is the default DOM vendor used. But you can change which DOM vendor is used. You just have to assign the DOM vendor's name to the global DefaultDOMVendor
variable in the Xml.XmlDom.pas
unit, and make sure a corresponding DOM implementation has been registered via RegisterDOMVendor()
(for MSXML and ADOM/OpenXML, simply add the corresponding DOM implementation unit in your uses
clause - Xml.Win.msxmldom
for MSXML, Xml.adomxmldom
for ADOM/OpenXML - as they call RegisterDOMVendor()
internally).
So in this case, you would simple find (or make) a DOM implementation wrapper for OmniXML so it can plug into TXMLDocument
, then register it with RegisterDOMVendor()
, and set the DefaultDOMVendor
variable to the registered DOM name.