SP15: XML Content and Actions
It took 3 months, but finally here is the last blog about the major features that were added to SAP NetWeaver Portal 2004, SP15. Today we look at the changes to the XML Content and Actions tool, which lets you automate the creation of portal content.
Instead of using the administration interfaces to create iViews, pages, worksets, roles and other portal objects, you can simply upload an XML file with all the information and — poof! — all you content is created. The tool is good if you are designing content on a test machine, and then you want to create the content on another machine.
Also, if you need to create a lot of objects that are similar — several roles with similar structure; you create the XML for one role, and simply duplicate it in the file and upload the file.
In addition, some companies design their content based on some back-end data, or use some tool (such as Excel) to define the content. From Excel, for example, you can then create a small conversion algorithm to export the Excel data to XML, and then upload the XML.
The tool is a lot like the PCD Inspector, in that it provides a type of backdoor for modifying PCD content. And like the PCD Inspector, you must be careful and check your XML, as you can create a lot of content — but also do a lot of other things, perhaps unintentionally, to harm the portal.
A Quick Review
Open the tool by going to System Administration –> Transport –> XML Content and Actions.
The import tool lets you upload a well-formed and valid XML file. After you export the file, the portal parses it and creates the portal objects and performs the actions defined in the XML. A report of the execution is displayed, showing what objects were created, what actions were performed, what sections did not parse correctly, and so forth.
How to Write XML to Create Content
The XML for the XML Content and Actions tool is, essentially, a collection of tags, possibly nested, and each tag defines an object to create, modify or delete. The type of object is specified by the handler name provided in the objectClass attribute. For example, to create an iView, you specify com.sapportals.portal.iview.
You can also add tags, that specify an action — such as deleting all objects from a folder, running another script, or assigning users to groups. These tags are not nested.
The main addition in SP15 was the addition of an export tool, that lets you take existing content and create an XML file based on it. You can then take this XML file, modify as needed, and upload the file so that the content — or similar content — is created on the same portal, perhaps in a different area, or on another portal.
With the tool, you do not need to code XML by hand. You can design the skeleton of what you want and export it to XML. You can then modify the attributes, copy the elements to create additional objects, and so forth. In addition, a large group of handlers were added in SP13, with which you still may not be familiar.
The following objects can now be created:
- Translation worklists
- Related items (of iViews)
- System aliases
The following actions can now be performed:
- Run a script from within another script
- Copy and mirror content
- Assign users to groups and roles
And, of course, we have a document that explains all the rules for building a valid XML file for the XML Content and Actions tool. It also lists all the objects you can create and all the actions that you can perform.
The documentation is located at How to Automate Content Creation via XML.