(Originally posted 2009-04-07.)
In Workload Manager Policy in XML Format – Part I I showed you how you can use PHP to extract Classification Rules information from the WLM Service Definition (once converted to XML format).
There is a slightly ulterior motive here: Acquainting mainframe people with some of the more modern web techniques. (I’m hoping you’ll explore some of them for yourselves.)
Here’s some sample code:
// Get workload description descNode=workloads[w].getElementsByTagName("Description").firstChild workloadDesc=descNode.nodeValue
// Create list item and add workload name / desc to it li=document.createElement("li") liText=document.createTextNode(workloadName+" - "+workloadDesc) li.appendChild(liText) // List item to the list ul.appendChild(li) } } } } req.send(null);</script></body></html>
Now, hopefully that wasn’t too intimidating: If you have a webserver to stick your XML on try it for yourself: The only thing you’ll need to change is the target URL in the XMLHttpRequest.
Most of the code is designed to fire – as a block – when the XML document is retrieved. It parses the returned XML, looking for “<Workload>” elements. The list of those is in array “workloads”.
For each of the workloads it looks for “<Name>” and “<Description>” elements and retrieves the text associated with them.
Finally, for each workload, a new “<li>” tag is created and populated with the workload’s name and description.
Thus the code sample prints a list of workloads and their descriptions.
There’s obviously a lot more in the WLM Service Description. I’ve shown you two techniques for parsing it. The simplest thing to do next is to convert your own WLM Service Definition to XML and browse it with a text editor. (On Windows I’m using Notepad++ but any editor will do, preferably one that syntax highlights XML).