Playing With Parse XML rules... This document demonstrates how Parse XML rules can be used to map XML into a PRPC Data Model. It builds upon rules created in these two other documents: so it's best to view these first (but I have included a 'Quick Recap' here as well in case you just want to view this document without bothering with the others in detail). "Transforming Data. Building Stuff In the Model. Utilizing Java APIs...." "Using XML Stream Rules to create XML (Excel again) documents."

Quick Recap: The following screenshots illustrate building nested 'Parse XML' rules that can be used to populate an existing PRPC data model: that data model (see above) is a simplified version of an Excel Spreadsheet:

As our input XML we are going to parse a Microsoft 2003 XML format (a single document format; which suits our purposes here): we are going to parse out a very small subset of this (quite rich) document format - so all styles, formulas, fonts (etc) are all stripped out. This format looks like this: (abridged and simplified here): [...]

And as a test we are going to use an existing Activity ("GenerateExcelFile") which uses the Apache POI library to create a (binary) EXCEL document based on our PRPC model - after we have built it based on the XML Parse Rules. [So we'll end up with a 'Converter' utility in effect]. For an input document: I took some existing data from the Web (a list of British railway stations - not the most exciting of datasets, but it's quite simple ) and saved it in Excel 2003 XML format. (The original was CSV).

Generated by Pega Mesh on 2016-10-03-05:00 1

Playing With Parse XML rules...

Steps: We start at the 'bottom' of our Data Model - at the 'Cell' Level: and create our first Parse Rule.

We need to double-click each element/attribute to set the XML namespace correctly ("urn:schemas-microsoftcom:office:spreadsheet").

Generated by Pega Mesh on 2016-10-03-05:00 2

Playing With Parse XML rules...

And we can run this against an XML 'Cell' fragment using Actions>Run

We enter out XML fragment in: ensuring that we have the correct XML namespace :

Generated by Pega Mesh on 2016-10-03-05:00 3

Playing With Parse XML rules...

Pressing Execute returns our PRPC Page (as XML as well): showing that mapping has taken place (Value="Cell1", Type="String"):

Here's the data from the screenshots above for reference: First the 'raw' input fragment:

Cell1