Question
Parse-XML : Conversion of XML tags from Japanese in English before calling Apply-Parse-XML method in activity
Hi,
Requirement is to upload the XML file (which is having all Japanese tags) and save the XML data to the corresponding DB tables.
we generated the parse-XML rule as per the structure of XSD. All properties in Pega are created in English only.
Now user will upload the XML file (with Japanese tags) via button.
I would like to understand how should we convert all Japanese tags to English before calling Apply-Parse-XML method.
we are using Java step in parse activity and using the below function:
fileContent= fileContent.replace("<Japanese Tag>","<English Tag>")
However, we have more than 100 tags in our XML file.
Any approach to implement this ?
Hi,
Can anyone suggest any approach to achieve this ?
Requirement -
We have a XML file which contains all Japanese tags, however in Pega we have Parse-XML rule with English Node names.
Now when user upload the XML with the Japanese tags, we want the conversion to happen so that Pega can map the XML tags with our Parse-XML rule Nodes.
Approach we tried :
We added java step in the activity, which first read the XML file and then replace the file content with English name. Below is the code we wrote:
ClipboardPage primary = tools.getPrimaryPage();
// read the XML file
try{
java.util.HashMap hmFileInfo = pega_rules_utilities.uploadFile(true);
Sring strFileData = (String)hmFileInfo.get("FileData");
// Decoding the file
try {
fileContent = new String(org.apache.commons.binary.Base64.decodeBase64(strFileData),"UTF-8");
// convert all Japanese node to English node
fileContent = fileContent.replace("<Japanese Tag1>","<English Tag1>");
fileContent = fileContent.replace("<Japanese Tag2>","<English Tag2>");
fileContent = fileContent.replace("<Japanese Tag3>","<English Tag3>");
}
catch(java.io.UnsupportedEncodingException e){
// code for Exception Handling for file decode
}
}
catch (PRRuntimeException pre)
{
// Exception Handling code
}
The above piece of java code works fine, however there are more than 100 tags in the XML tag and we need to convert them all in English before calling the Apply-Parse-XML step in the activity.
We are looking for any other easy way to convert these many tags to English without writing these many lines of java code.
Thanks,
Praveen