Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I did a job where it :
* Extracts an email from a IMAP server using tPOP
* Iterates and reads the email using tFileList and tFileInputMail
* Prints the results of the params of the tFileInputMail component with tLogRow
* Creates an XML with the params of the tFileInputMail output.
I got the next model:
Everything is working fine (There's no code at tJavaRow yet ). But as almost of the software projects, the requirements have changed.
Now, I need to create an XML based on my extracted email. I need extract the a regex for Content/body tag of the MailPart of the tFileInputMail component.
The Mail part required:
The regex required (in Java code):
"(\\#Location.*?\\;)|(\\#City.*?\\;)"
I'm using a tJavaRow component in order to modify the content of the tag as follow:
code:
//Code generated according to input schema and output schema output_row.Content = input_row.Content; String data = String.valueOf(output_row.Content); if (data!= null) { Pattern pattern = Pattern.compile("(\\#Location.*?\\;)|(\\#Area.*?\\;)"); Matcher matcher = pattern.matcher(data); while(matcher.find()) { int i =0; //System.out.println(matcher.group(i)+"\n"); row3.Content.replaceAll("(\\#Location.*?\\;)|(\\#Area.*?\\;)", matcher.group(i)); i++; } }
But is not possible to change the Content attribute of the row3. At row3, I can see the String that I want to replace for the result of the regex (regex is working fine) but no modify or replace it.
How can I change this data? Is it possible?
Thanks and regards!
P.S.: Additional information:
1. The email original content/body (row3.Content original content that I can see)
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> <meta name="Generator" content="Microsoft Word 15 (filtered medium)"> <style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-fareast-language:EN-US;} a:link, span.MsoHyperlink {mso-style-priority:99; color:#0563C1; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:#954F72; text-decoration:underline;} span.EstiloCorreo17 {mso-style-type:personal-compose; font-family:"Calibri",sans-serif; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; font-family:"Calibri",sans-serif; mso-fareast-language:EN-US;} @page WordSection1 {size:612.0pt 792.0pt; margin:70.85pt 3.0cm 70.85pt 3.0cm;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]--> </head> <body lang="ES" link="#0563C1" vlink="#954F72"> <div class="WordSection1"> <p class="MsoNormal" style="margin:11.25pt;text-align:justify">Test<o:p></o:p></p> <p class="MsoNormal" style="margin:11.25pt;text-align:justify">#Area:AreaTest:;<o:p></o:p></p> <p class="MsoNormal" style="margin:11.25pt;text-align:justify"><o:p> </o:p></p> <p class="MsoNormal" style="margin:11.25pt;text-align:justify">Other testing mesagges<span style="font-size:13.5pt;font-family:"Times New Roman",serif;color:black;letter-spacing:.75pt;mso-fareast-language:ES"><o:p></o:p></span></p> <p class="MsoNormal"><o:p> </o:p></p> </div> </body> </html>
2. I just want in row3.Content the next result of the application of the regex rules.
#Area:AreaTest:;
I found the answer.
First
It's necessary import all of input schema and output schema
Second
Assign directly the value of the row through a StringBuilder object.
Finally
And I got my XML file according to the modifed routine.
Cheers!
I found the answer.
First
It's necessary import all of input schema and output schema
Second
Assign directly the value of the row through a StringBuilder object.
Finally
And I got my XML file according to the modifed routine.
Cheers!