cancel
Showing results for 
Search instead for 
Did you mean: 

suppress node and all subnodes

Former Member
0 Kudos

Hello experts.

I have this structure (for example):

<AAA>

<ID>A1</ID>

<B1>1</B1>

<B2>2</B2>

...

<B100>100</B100>

</AAA>

<AAA>

<ID>A2</ID>

<B1>1</B1>

<B2>2</B2>

...

<B100>100</B100>

</AAA>

<AAA>

<ID>A3</ID>

<B1>1</B1>

<B2>2</B2>

...

<B100>100</B100>

</AAA>

I have a need for the following mapping:

If the ID=A2, I need to suppress the whole <AAA> element with all it's subnodes.

So in the example the result of the mapping should be:

<AAA>

<ID>A1</ID>

<B1>1</B1>

<B2>2</B2>

...

<B100>100</B100>

</AAA>

<AAA>

<ID>A3</ID>

<B1>1</B1>

<B2>2</B2>

...

<B100>100</B100>

</AAA>

Is there an elegant way of doing this?

I don't want to add a check for 100 elements - to see if ID=A2...

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Use a two-step mapping,

the first mapping is one-to-one mapping but the logic in AAA is like this


ID -> removeContext ->equalsS -> ifWithoutElse -> AAA
          constant: A2 /  AAA -> /

Second mapping is if you need additional mapping logic.

Hope this helps,

Mark

Edited by: Mark Dihiansan on Nov 23, 2011 9:35 AM

Former Member
0 Kudos

Wow.

This is a great solution (:

I did exactly what you said, just without the remove context.

I didn't know that the remove context will make the mapping skip the whole elemt.

Thanks alot.

Answers (0)