cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > TransformationFeature
Date Tue, 22 Feb 2011 16:05:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2036/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/TransformationFeature">TransformationFeature</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://cwiki.apache.org/confluence/display/~sergey_beryozkin">Sergey
Beryozkin</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <p>The CXF Transformation feature provides for a flexible and fast way to do
the dynamic transformations of the inbound and/or outbound XML messages. </p>

<p>This feature can be used in a number of cases: dropping the namespace of the outbound
messages, qualifying the incoming message, changing namespaces, appending or dropping elements
and converting attributes to elements.</p>

<p>The following configuration properties have been added to the base JAXB/JSON AbstractJAXBProvider
:</p>

<ul class="alternate" type="square">
	<li>"outTransformElements" map property: can be used to change the output element names
and change or drop namespaces; keys are the elements to be changed, values are the new element
names. Examples:</li>
</ul>


<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;bean id=<span class="code-quote">"transformFeature"</span>
class=<span class="code-quote">"org.apache.cxf.feature.StaxTransfromFeature"</span>&gt;</span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"outTransformElements"</span>&gt;</span>
    <span class="code-tag">&lt;map&gt;</span>
      <span class="code-tag"><span class="code-comment">&lt;!-- change <span
class="code-quote">"book"</span> to <span class="code-quote">"thebook"</span>
--&gt;</span></span>
      <span class="code-tag">&lt;entry key=<span class="code-quote">"book"</span>
value=<span class="code-quote">"thebook"</span>/&gt;</span>
      
      <span class="code-tag"><span class="code-comment">&lt;!-- drop the namespace
from <span class="code-quote">"book"</span> --&gt;</span></span>
      <span class="code-tag">&lt;entry key=<span class="code-quote">"{http://books}book"</span>
value=<span class="code-quote">"book"</span>/&gt;</span> 
      
      <span class="code-tag"><span class="code-comment">&lt;!-- qualify <span
class="code-quote">"book"</span> with <span class="code-quote">"http://books"</span>
--&gt;</span></span>
      <span class="code-tag">&lt;entry key=<span class="code-quote">"book"</span>
value=<span class="code-quote">"{http://books}thebook"</span>/&gt;</span>

      
      <span class="code-tag"><span class="code-comment">&lt;!--  change namespace
to <span class="code-quote">"http://books"</span> for all the elements with the
<span class="code-quote">"http://book"</span> namespace --&gt;</span></span>
      <span class="code-tag">&lt;entry key=<span class="code-quote">"{http://book}*"</span>
value=<span class="code-quote">"{http://books}*"</span>/&gt;</span>

    <span class="code-tag">&lt;/map&gt;</span>
  <span class="code-tag">&lt;/property&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span> 
</pre>
</div></div>

<ul class="alternate" type="square">
	<li>"inTransformElements" map property: can be used to change the input element names
and change or drop namespaces; see the "outTransfromElements" property description for an
example.</li>
</ul>


<ul class="alternate" type="square">
	<li>"outAppendElements" map property: can be used to append new simple or qualified
elements to the output; keys are the new elements, values are the elements the new ones will
be appended before. Examples:</li>
</ul>


<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;bean id=<span class="code-quote">"transformFeature"</span>
class=<span class="code-quote">"org.apache.cxf.feature.StaxTransfromFeature"</span>&gt;</span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"outAppendElements"</span>&gt;</span>
    <span class="code-tag">&lt;map&gt;</span>
      <span class="code-tag"><span class="code-comment">&lt;!-- append <span
class="code-quote">"book"</span> before <span class="code-quote">"thebook"</span>
--&gt;</span></span>
      <span class="code-tag">&lt;entry key=<span class="code-quote">"book"</span>
value=<span class="code-quote">"thebook"</span>/&gt;</span>
      
      <span class="code-tag"><span class="code-comment">&lt;!-- qualify <span
class="code-quote">"book"</span> with <span class="code-quote">"http://books"</span>
--&gt;</span></span>
      <span class="code-tag">&lt;entry key=<span class="code-quote">"{http://books}book"</span>
value=<span class="code-quote">"book"</span>/&gt;</span> 
      
      <span class="code-tag"><span class="code-comment">&lt;!-- drop the namespace
from the <span class="code-quote">"book"</span> --&gt;</span></span>
      <span class="code-tag">&lt;entry key=<span class="code-quote">"book"</span>
value=<span class="code-quote">"{http://books}thebook"</span>/&gt;</span>

      
      <span class="code-tag"><span class="code-comment">&lt;!--  change namespace
to <span class="code-quote">"http://book"</span> for all the elements with the
<span class="code-quote">"http://books"</span> namespace --&gt;</span></span>
      <span class="code-tag">&lt;entry key=<span class="code-quote">"{http://book}*"</span>
value=<span class="code-quote">"{http://books}*"</span>/&gt;</span>

    <span class="code-tag">&lt;/map&gt;</span>
  <span class="code-tag">&lt;/property&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span> 
</pre>
</div></div>

<ul class="alternate" type="square">
	<li>"inAppendElements" map property : can be used to append new simple or qualified
elements to the input; see the "outAppendElements" property description for an example.</li>
</ul>


<ul class="alternate" type="square">
	<li>"outDropElements" list property : can be used to drop elements during the serialization;
note that children elements if any of a given dropped element are not affected. Examples:</li>
</ul>


<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;bean id=<span class="code-quote">"transformFeature"</span>
class=<span class="code-quote">"org.apache.cxf.feature.StaxTransfromFeature"</span>&gt;</span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"outDropElements"</span>&gt;</span>
    <span class="code-tag">&lt;list&gt;</span>
      <span class="code-tag"><span class="code-comment">&lt;!-- ignore drop
and {http://numbers}number elements --&gt;</span></span>
      <span class="code-tag">&lt;value&gt;</span>{http://numbers}number<span
class="code-tag">&lt;/value&gt;</span>
      <span class="code-tag">&lt;value&gt;</span>index<span class="code-tag">&lt;/value&gt;</span>
    <span class="code-tag">&lt;/list&gt;</span>
  <span class="code-tag">&lt;/property&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span> 
</pre>
</div></div>

<ul class="alternate" type="square">
	<li>"inDropElements" list property : can be used to drop elements during the deserialization;
note that children elements if any of a given dropped element are not affected. Please see
the "outDropElements" property description for an example.</li>
</ul>


<ul class="alternate" type="square">
	<li>"attributesAsElements" boolean property : can be used to have attributes serialized
as elements.</li>
</ul>


<p>The combination of "attributesAsElements" and "outDropElements" properties can be
used to have certain attributes ignored in the output by turning then into elements first
and then blocking them.</p>


    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/TransformationFeature">View
Online</a>
              |
       <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/TransformationFeature?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message