XML data binding: Difference between revisions

Content deleted Content added
OTM24 (talk | contribs)
added citation
OTM24 (talk | contribs)
copy edits
Line 21:
==Alternatives==
 
An alternative approach to automatic data binding relies instead on hand-crafted [[XPath]] expressions that extract data from XML. This approach has some benefits, but also has some drawbacks. First, the approach only needs proximate knowledge (e.g., topology, tag names, etc.) of the XML tree structure, which developers can determine by looking at the XML data. Furthermore, XPath allows the application to bind the relevant data items and filter out everything else, avoiding the unnecessary processing that would be required to completely unmarshall the entire XML document. The drawback of this approach is the lack of automation in implementing the object model and XPath expressions. Instead, the application developers have to create these artifacts manually, which is time -consuming, potentially error -prone, and hampers application maintenance when XML schemas and XML content models are updated. Another drawback is the lack of XML schema verification, which XML data bindings typically apply automatically during unmarshalling. Schema validity is typically required in secure applications.
 
==Data binding in general==
One of XML data binding's strengths is the ability to [[serialization|deserialize]] objects across programs, languages, and platforms.<ref>[https://www.ibm.com/docs/en/odm/8.12.0?topic=binding-what-is-xml "What is XML binding"] IBM. Retrieved 2024-04-16.</ref> You can dump a time series of structured objects from a datalogger written in [[C (programming language)]] on an embedded processor, bring it across the network to process in [[Perl]] and finally visualize in [[GNU Octave|Octave]]. The structure and the data remain consistent and coherent throughout the journey, and no custom formats or parsing is required. This is not unique to XML. [[YAML]], for example, is emerging as a powerful data -binding alternative to XML. [[JSON]] (which can be regarded as a subset of YAML) is often suitable for lightweight or restricted applications.
 
==XML data binding frameworks==