Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 14 in printed book and digital formats -- plus a one-year subscription so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 15.6 ('Green Screen Saver')
Instant purchase and download via GumRoad!

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):

Download Icon 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 class IOImport, 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.