Created 11-09-2017 12:24 PM
I want to add xml tag ${filename} to xml response which i got from service how should i do it i mean i have made replace, end even delet operations in replaceText processor but how can i add something?
<?xml version="1.0" encoding="UTF-8"?> <service> <Person> <details> <start>2017-10-22</start> <id>*******</id> <makeVersion>1</makeVersion> <patch>patch</patch> <parameter>1</parameter> </details> </Person> </service>
Created on 11-10-2017 07:04 PM - edited 08-18-2019 01:27 AM
yeah, you can do that by using replace text processor with
search value property as
<details>\s*([\s\S]+.*)\n+\s+<\/details> //capture every thing enclosed in details tag as capture group 1
then in replacement value
<details> ${filename} $1 </details>
you can customize the replacement value as per your needs.
Replace Text processor Configs:-
input:-
<?xml version="1.0" encoding="UTF-8"?> <service> <Person> <details> <start>2017-10-22</start> <id>*******</id> <makeVersion>1</makeVersion> <patch>patch</patch> <parameter>1</parameter> </details> </Person> </service>
output:-
<?xml version="1.0" encoding="UTF-8"?> <service> <Person> <details> 1497701925152409 <start>2017-10-22</start> <id>*******</id> <makeVersion>1</makeVersion> <patch>patch</patch> <parameter>1</parameter> </details> </Person> </service
Created on 11-10-2017 07:04 PM - edited 08-18-2019 01:27 AM
yeah, you can do that by using replace text processor with
search value property as
<details>\s*([\s\S]+.*)\n+\s+<\/details> //capture every thing enclosed in details tag as capture group 1
then in replacement value
<details> ${filename} $1 </details>
you can customize the replacement value as per your needs.
Replace Text processor Configs:-
input:-
<?xml version="1.0" encoding="UTF-8"?> <service> <Person> <details> <start>2017-10-22</start> <id>*******</id> <makeVersion>1</makeVersion> <patch>patch</patch> <parameter>1</parameter> </details> </Person> </service>
output:-
<?xml version="1.0" encoding="UTF-8"?> <service> <Person> <details> 1497701925152409 <start>2017-10-22</start> <id>*******</id> <makeVersion>1</makeVersion> <patch>patch</patch> <parameter>1</parameter> </details> </Person> </service