Article Preview
Buy Now
FEATURE
Sharing Data for Health, Part 4
Importing health data from XML
Issue: 15.6 (November/December 2017)
Author: JC Cruz
Author Bio: JC is a freelance writer based in British Columbia. He contributes regularly to MacTech Magazine and Dr Dobb's Journal. Away from the writing pile, JC spends quality time with his nephew, as a proper uncle should.
Article Description: n>No description availabl
Article Length (in bytes): 30,306
Starting Page Number: r>
Article Number: 15607
Resource File(s):
project15607.zip Updated: 2017-11-01 11:56:19
Related Link(s): None
Excerpt of article text...
Last time, I demonstrated how I export health data to an external XML file. Now I shall do the reverse--importing data from a similar file.
I start by describing the challenges I face to support XML import. I revisit the
XMLDocument
class and study the accessor methods I need to parse and extract the imported data. I show how I extended the custom engine classIOImport
, and I show how I implemented an XML-specific import workflow.Readers need a working knowledge of Xojo, XML, and object-oriented design. An updated version of the FooHealth demo project (mk10.3) is available from the magazine's website.
The XML Challenge
Like HTML, XML uses markup tags to contain and arrange user data. But XML tags are
user-defined , and they can form arbitrary structures. So the parsing routines I used for HTML will not work well with XML, if they work at all. Modifying and maintaining those parser routines is also costly in resources and time.A better approach is to use the
XMLDocument
class itself to parse the imported XML text and extract the relevant data.
...End of Excerpt. Please purchase the magazine to read the full article.