What is the DOM?
The Document Object Model (DOM) is a programming interface for HTML and XML documents. It provides a structured representation of the document (a tree) and it defines a way that the structure can be accessed from programs so that they can change the document structure, style and content.
Creating the LabVIEW DOM
Extracting the DOM from a LabVIEW program is tedious. I have created a simple LabVIEW program that starts with the current VI reference, gets the array of front panel control references, extracts the properties of each of the controls and stores them in a JSON object. All the front panel controls share common properties such as height and width. Each type of control has further properties specific to that class. (For the OOP LabVIEW programmers this could be a good exercise.) I prefer the direct method and have added a case structure with a case for each of the control types and logic to convert the unique properties to JSON. When the program completes the output is a JSON string with the all the properties of all the front panel controls.
Sample JSON for a LabVIEW Front Panel Vertical Progress Bar
Running a LabVIEW front panel on an iPad or web browser is done by assembling all the properties of the LabVIEW front panel controls into a JSON object, sending that object to an iPad app or web browser, then reading the JSON object and creating HTML elements with CSS styling that recreates the LabVIEW front panel. Through LabVIEW Web Services it is then possible to pass control states and data between the iPad and the LabVIEW program to keep the two front panels in-sync.