Enhancing the element-append and drop options of InTransformReader used by
transform feature
--------------------------------------------------------------------------------------------
Key: CXF-3692
URL: https://issues.apache.org/jira/browse/CXF-3692
Project: CXF
Issue Type: Improvement
Components: Core
Affects Versions: 2.4.1
Reporter: Aki Yoshida
Assignee: Aki Yoshida
Fix For: 2.5
The current implementation is limited to
*transform*
transform the name of an existing element from x1:e1 to x2:e2,
from
{code:xml}
<x1:e1 xmlns:x1="ns1" ...>
<x3:e3>...</x3:e3>
</x1:e1>
{code}
to
{code:xml}
<x2:e2 xmlns:x2="ns2">
<x3:e3>...</x3:e3>
</x2:e2>
{code}
using element property
key="{ns1}e1" value="{ns2}e2"
*append*
wrap an existing element x1:e1 with a new element x2:e2,
from
{code:xml}
<x1:e1 ...>...</x1:e1>
{code}
to
{code:xml}
<x2:e2 ...>
<x1:e1 ...>...</x1:e1>
</x2:e2>
{code}
using append property
key="{ns1}e1" value="{ns2}e2"
*drop*
unwrap an existing element x1:e1 from element x2:e2,
from
{code:xml}
<x2:e2 ...>
<x1:e1 ...>...</x1:e1>
</x2:e2>
{code}
to
{code:xml}
<x1:e1 ...>...</x1:e1>
{code}
using drop property
value="{ns2}e2"
The enhanced implementation provides the following additional operations.
*deep-drop*
drop an existing element x2:e2 completely,
from
{code:xml}
<x3:e3 ...>
<x2:e2 ...>
<x1:e1>...</x1:e1>
</x2:e2>
<x2:e4>...</x2:e4>
</x3:e3>
{code}
to
{code:xml}
<x3:e3 ...>
<x2:e4>...</x2:e4>
</x3:e3>
{code}
using transform property
key="{ns2}e2" value=""
In contrast, the previously supported drop (or unwrap) operation can be seen as
a shallow drop which results in
{code:xml}
<x3:e3 ...>
<x1:e1>...</x1:e1>
<x2:e4>...</x2:e4>
</x3:e3>
{code}
using drop property
value="{ns2}e2"
*append-pre-include*
append a new element x2:e2 with content v2 before an existing element x1:e1,
from
{code:xml}
<x3:e3 ...>
<x1:e1>...</x1:e1>
</x3:e3>
{code}
to
{code:xml}
<x3:e3 ...>
<x2:e2>v2</x2:e2>
<x1:e1>...</x1:e1>
</x3:e3>
{code}
using append property
key="{ns1}e1" value="{ns2}e2:v2"
*append-post-include*
append a new element x2:e2 with content v2 inside an existing element x3:e3,
from
{code:xml}
<x3:e3 ...>
<x1:e1>...</x1:e1>
</x3:e3>
{code}
to
{code:xml}
<x3:e3 ...>
<x2:e2>v2</x2:e2>
<x1:e1>...</x1:e1>
</x3:e3>
{code}
using append property
key="{ns3}e3/" value="{ns2}e2:v2"
*append-post-wrap*
append a new element x2:e2 to wrap the content of an existing element x3:e3,
from
{code:xml}
<x3:e3 ...>
<x1:e1>...</x1:e1>
<x2:e4>...</x2:e4>
</x3:e3>
{code}
to
{code:xml}
<x3:e3 ...>
<x2:e2>
<x1:e1>...</x1:e1>
<x2:e4>...</x2:e4>
</x2:e2>
</x3:e3>
{code}
using append property
key="{ns3}e3/" value="{ns2}e2"
In contrast, the previously supported append (or wrap) can be considered as
append-pre-wrap which results in
{code:xml}
<x2:e2>
<x3:e3 ...>
<x1:e1>...</x1:e1>
<x2:e4>...</x2:e4>
</x3:e3>
</x2:e2>
{code}
using append property
key="{ns3}e3" value="{ns2}e2"
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira