XML (Extensible Markup Language) format is widely used on the internet, and XML-based languages have become the default for many tools, such as Microsoft Office, OpenOffice, iWork, and Google Earth. So it is not surprising when JMP users come across some XML-based data that looks like this:
JSL has a function called "Parse XML" to make importing XML data easier. In the above XML example, ONSALE is a start tag, and /ONSALE is an end tag. There are two pairs of ITEM tags within ONSALE, each containing a pair of NAME tags and PRICE tags. Using "Parse XML," you can look for certain tags and take action. Furthermore, you can tie the timing of the action to either the start tag or the end tag, or both. The JSL below uses "Parse XML" to get the useful information from the XML sample.
xml_file = load text file("onsaleItems.xml");
Start Tag(print("The following items are on sale")),
message = item_name || " for " || item_price || " a pound.";
End Tag(item_name = XML Text(); ),
End Tag(item_price = XML Text(); ),
"The following items are on sale"
"Banana for 0.59 a pound."
"Tomato for 1.19 a pound."
The book JSL Companion: Application of the JMP Scripting Language has an in-depth section about XML parsing and importing XML data into JMP table. One of the authors, Theresa Utlaut, shared "Sample Code and Data," including several scripts about XML parsing on her SAS Press author Web page.
I have recently used the XML parser for a mapping-related add-in, the KML Polygon Importer, which you can download from the JMP File Exchange (download requires free SAS profile). KML stands for Keyhole Markup Language. It became an international standard of the Open Geospatial Consortium, and it is becoming increasingly popular as a mapping tool. Because KML is XML-based, I was able to use the XML parser to import the KML maps into JMP data tables, which then can be displayed as JMP maps. Here is a KML model of Bloomington, Indiana, being displayed in JMP. Each shape is a building viewed from above and is shaded according to its average altitude.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.