Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

How to Extract value from XML object from Schema

CSLTGUPTAA
Level 2
Level 2

Hi, 

I want to extract email "Subject" value from email header parameter (which is xml object) from broadLogRcp(deliveries) 

in my workflow. Any insight/sample code would be highly appreciated. 

Example : I want to extract user's email "Subject" from "email header parameters" under Delivery from broadLogRcp schema just to know the Subject of the emails sent out.

Currently user's email "Subject"  in "email header parameter" is in XML object format so directly we can get the value so I am trying to write one JavaScript code for the same, so need help to find a solution around this. appreciate your time on this.

Looking forward...

-CSLTgupta

1 Accepted Solution
wodnicki
Correct answer by
Community Advisor
Community Advisor

Hi,

 

It's ordinary XML/E4X. To parse the data field's XML with js, use var delivery = new XML(data).

 

Thanks,

-Jon

View solution in original post

5 Replies
SachinDhir
Level 2
Level 2

Data Extraction (file) activity allows doing that.

Otherwise, we can't extract using query or enrichment activity.

 

 

wodnicki
Correct answer by
Community Advisor
Community Advisor

Hi,

 

It's ordinary XML/E4X. To parse the data field's XML with js, use var delivery = new XML(data).

 

Thanks,

-Jon

View solution in original post

CSLTGUPTAA
Level 2
Level 2
thanks Jon for your suggestion. But Can you please elaborate your comments. FYI - here is code snippet below which I'm trying to use :
CSLTGUPTAA
Level 2
Level 2

var query = xtk.queryDef.create( <queryDef schema="nms:delivery" operation="select" lineCount="5"> <select> <node expr="[delivery/mailParameters/@subject]" alias="@data"/> </select> </queryDef> ) var delivery = new XML(data); var res = query.ExecuteQuery();

 

Can you please review this and point out the right direction? thanks in advance for all your help.

wodnicki
Community Advisor
Community Advisor
<node expr="data"/> and then new XML(res.data)