cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Splitting exported XML into separate objects

Splitting exported XML into separate objects

Objects' XML representations can be extracted from IdentityIQ through the IIQ console using the export and checkout commands. The export command writes all objects of one or more types to a single XML file. The checkout command writes a single named object to an XML file.

Frequently, customers want to get all objects of a given type out of the system at once but need them all in separate files (e.g. to store them separately in a source code repository). Though there is no built in console command that does bulk exports into separate files, the attached Perl script can take the output from an export command and parse it into separate files per object.

How to use this script:

  1. Download the script to the filesystem where IdentityIQ is installed.
  2. Use the export command to export all objects of a given type from the console. Note: This script only parses export files that were created with the -clean option  (ID values stripped).
    • > export -clean /home/spadmin/artifacts/workflows.xml workflow
  3. Run this script, providing the export filename and the target directory name. (When no target directory is specified, split files will be written to a subdirectory of the current directory called splitOut.)
    • $ ./splitXml.pl /home/spadmin/artifacts/workflows.xml splitWorkflows
    • (This creates separate files for each workflow in a subdirectory of the current directory called splitWorkflows.)
Labels (1)
Attachments
Comments

Nice tool, thanks for that!

I encountered an issue when using the tool which could be tracked down to "unpretty" XML - the tool relies on the XML being formatted in a specific way.

Aftter using the pretty print functionality (with linebreaks!) of the Notepad++ XML Tools Plugin, everything went smoothly.

Very helpful!

I found an issue where the exported <sailpoint> tags are getting cut off. A good example is the OOTB ObjectConfig object for Link. Even though this isn't a commonly managed object, it breaks the <sailpoint> tags and will break the WAR building process.

To split all XML files exported with ExportScript.txt, you can use the following script:

#!/bin/bash
for f in `ls -1 *.xml`;do
     ./splitxml.pl $f `echo $f | awk '{ print substr($0,8,length($0)-19) }'`
done

A very nice tool. But I run into an issue with object name contains a single quotation mark. for example: Objects in Requestor's Authorized Scopes

I'm seeing the same issue. Is there a fix for this?

The issues when the names contain things like single quotation marks or certain other characters, can be fixed by making the following modifications to the code:

Search for the part where the script assigns a value to: $objectNameHy.

A few lines above that, are 2 regular expressions that define what should be used for the name. Edit the regular expressions to include the characters that are causing the errors. 

And below the assignment are substitutions that replace things like "&" with "and". Add the appropriate substitutions here to create a normal filename.

By the way: if you want separate xml files, you could also use the SSD XML Exporter. Here's a link to the 3.1 version:

SSD XML Object Exporter 

maheshraj9_0-1592152884684.png

Im getting as unknown command as above. Can you please tell me how to overcome that

Just now tried the Object Exporter Version 3.0 and it did worked successfully . But Im not still understanding when using the attached script, in the cmd, it is still showing the $ symbol as unknown command. Tried to remove the dollar and executed the remaining command and still showing the result as unknown command.

Nothing but problems with this script.  Not sure if it's because it's running on Windows.  It does not handle various situations well and is just a headache.  Much easier to use the Java based splitter: https://community.sailpoint.com/t5/IdentityIQ-Wiki/Splitting-Exported-XML-into-Separate-Objects-Opti...

Excellent tool, but I expected an error while splitting exported XML files.

The error looks like this:

ERROR: unexpected line: [<Rule language="beanshell" name="Objects in Requestor's Authorized Scopes or Requestee's Assigned Scope" type="RequestObjectSelector">]

I found out that the ' in the name part caused splitxml.pl to raise an error!

As a solution, edit the XML file and get rid of ' in the name portion!

After modifying the file, splitxml.pl runs like a charm.

Version history
Revision #:
2 of 2
Last update:
‎Jul 25, 2023 06:54 PM
Updated by: