Is it possible to mask an xml namespace ?

A response xml could return data with the associated namespace as follows :

(note this is an example xml)

<root xmlns:h="http://www.fruits.org/html4/" xmlns:f="http://www.furniture.com/">
<h:table> 
<h:tr> 
<h:td>Apples</h:td> 
<h:td>Bananas</h:td> 
</h:tr> 
</h:table>
<f:table> 
<f:name>African Coffee Table</f:name> 
<f:width>80</f:width> 
<f:length>120</f:length> 
</f:table> 
</root>

Is there a way to mask the xmlns:h and xmlns:f values in the example above ?

0 6 415
6 REPLIES 6

Not applicable

Hi @Venkataraghavan ,

I don't see data masking working on XML responses having namespaces at all but works on XML which doesn't have namespaces on the same org

For example : In the above data masking on /root/f:table/f:width doesn't work.

@Mukundha Madhavan , @Anil Sagar any idea ?

works on

<Organization type="free" name="POC">
    <CreatedAt>1438739096957</CreatedAt>
    <CreatedBy>maruthi</CreatedBy>
    <DisplayName>POC</DisplayName>
    <Environments>
        <Environment>prod</Environment>
    </Environments>
    <LastModifiedAt>1438739096957</LastModifiedAt>
    <LastModifiedBy>maruthi</LastModifiedBy>
    <Properties/>
</Organization>

doesn't work on

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false"
        android:drawable="@drawable/abs__ic_clear_disabled" />
    <item android:drawable="@drawable/abs__ic_clear_normal" />
</selector>

Is it still not possible to mask data elements in XML responses having namespaces? We are facing the same issue and would like to see if there are any alternatives to achieve this.

@Venkataraghavan

Do you want to remove the xml namespaces or do you want to mask them?

If you want to remove the xml namespaces you can use the below XSLT which will remove namespaces.

<?xml version="1.0" encoding="utf-8"?><xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:outputmethod="xml"indent="yes"/><xsl:templatematch="*"><xsl:elementname="{local-name(.)}"><xsl:apply-templatesselect="@* | node()"/></xsl:element></xsl:template><xsl:templatematch="@*"><xsl:attributename="{local-name(.)}"><xsl:value-ofselect="."/></xsl:attribute></xsl:template></xsl:stylesheet>

Thanks Siva. I am not looking to remove the xml namespaces. I am looking to mask data elements within an xml response that uses namespaces. In my case, I have a namespace without a prefix. Apigee docs provides info on how to do this using masking configs here:

https://docs.apigee.com/api-platform/security/data-masking#maskingsensitivedata-maskingforxmlnamespa...

But it is not working.

For eg., I am trying to Mask the values for EmpId and GeoLocation in the xml below.

<?xml version="1.0" standalone="no"?>

<ExampleResponse xmlns="http://www.example.com/ExampleResponse">

<ABCCode>0000</ABCCode>

<EmpId>111111</EmpId>

<ProductId>99999999</ProductId>

<Products xmlns="http://www.example.com/PrdResponse">

<SubscrProfile>

<GeoLocation>LocationId</GeoLocation>

<PingTime>154210</PingTime>

</SubscrProfile>
</Products>

</ExampleResponse>

Please refer the below link which may suffice your requirement.

https://stackoverflow.com/questions/31348734/masking-xml-element-using-xslt

I can try this. But, I think this will actually replace the value of EmpId from '111111' to '*******', if I use * for masking. I just want these values to be masked as '******' ONLY while viewing the trace output in Apigee. But the actual value of EmpId should still remain as '111111' in the XML response.