cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how do I modify xml using query xml action item.

Hello all,

I am new to this community and posting for the first time.

I am trying to modify below XML:

<Top>

<ValueData xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"><Value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Proteomics</Value></ValueData>

<ValueData xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"><Value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Metabolomics</Value></ValueData>

<ValueData xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"><Value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Bioinformatics</Value></ValueData>

<ValueData xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"><Value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Mass Spectrometry</Value></ValueData>

</Top>

to get the output as:

<Top>

<ValueData><Value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Proteomics</Value></ValueData>

<ValueData><Value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Metabolomics</Value></ValueData>

<ValueData><Value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Bioinformatics</Value></ValueData>

<ValueData><Value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Mass Spectrometry</Value></ValueData>

</Top>

I want to remove attribute  xmlns from each <ValueData> tag. I tried doing this using XSLT with no luck. Any idea how to do that?

0 Kudos
Reply
5 Replies
Not applicable

Re: how do I modify xml using query xml action item.

I am saving these results in a multiple line of text variable so tried replace function as well:

fn-Replace(result xml, "xmlns=http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"", " ")

But as the string is ending with double quote ("), it is not working either.

0 Kudos
Reply
mapeacock
Nintex Newbie

Re: how do I modify xml using query xml action item.

Hi,

Have you tried using the {TextStart}{TextEnd} wrappers for your text? That should work. Try:

fn-Replace(result xml,{TextStart}xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"{TextEnd}, )

The other thing I did notice in your example was that you didnt have the " after the http in your text to replace sample:

fn-Replace(result xml, "xmlns=http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"", " ")

should have been:

fn-Replace(result xml, "xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"", " ")

Anyway I have tested my suggestion and it worked.

Cheers,

Mark

0 Kudos
Reply
Not applicable

Re: how do I modify xml using query xml action item.

Thanks a lot Mark for the suggestion!

I tried {TextStart}{TextEnd} wrappers, but it is not giving me the desired output.

I applied function as

fn-Replace(result xml,

{TextStart}xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"{TextEnd}, " ")

But it is giving me output as <ValueData "> instead of <ValueData >.

How to get rid of the trailing quote?

I tried using escape character as well with no luck.

0 Kudos
Reply
mapeacock
Nintex Newbie

Re: how do I modify xml using query xml action item.

Neha,

Please note that I did not include the " " in the replaced text in my example:

{TextEnd}, )

This should be left blank.

Regards,

Mark

Reply
Not applicable

Re: how do I modify xml using query xml action item.

It still did not work for me. Anyways, I modified my XSLT to work without the need to remove the attribute.

Thanks for helping though!

0 Kudos
Reply