camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > TidyMarkup
Date Tue, 16 Mar 2010 10:21:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CAMEL/TidyMarkup">TidyMarkup</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~foamdino">Kev
Jackson</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <h2><a name="TidyMarkup-TidyMarkup"></a>TidyMarkup</h2>

<p>TidyMarkup is a <a href="/confluence/display/CAMEL/Data+Format" title="Data Format">Data
Format</a> that uses the <a href="http://www.ccil.org/~cowan/XML/tagsoup/" rel="nofollow">TagSoup</a>
to tidy up HTML. It can be used to parse ugly HTML and return it as pretty wellformed HTML.</p>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Camel eats our own <del>dog
food</del> soap</b><br /><p>We had some issues in our pdf <a href="/confluence/display/CAMEL/Manual"
title="Manual">Manual</a> where we had some strange symbols. So <a href="http://janstey.blogspot.com/"
rel="nofollow">Jonathan</a> used this data format to tidy up the wiki html pages
that are used as base for rendering the pdf manuals. And then the mysterious symbols vanished.</p></td></tr></table></div>


<p><a href="/confluence/display/CAMEL/TidyMarkup" title="TidyMarkup">TidyMarkup</a>
only supports the <b>unmarshal</b> operation as we really don't want to turn well
formed HTML into ugly HTML <img class="emoticon" src="/confluence/images/icons/emoticons/smile.gif"
height="20" width="20" align="absmiddle" alt="" border="0"/></p>

<h3><a name="TidyMarkup-JavaDSLExample"></a>Java DSL Example</h3>
<p>An example where the consumer provides some HTML</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"file:<span class="code-comment">//site/inbox"</span>).unmarshal().tidyMarkup().to(<span
class="code-quote">"file://site/blogs"</span>);</span>
</pre>
</div></div>

<h3><a name="TidyMarkup-SpringXMLExample"></a>Spring XML Example</h3>
<p>The following example shows how to use <a href="/confluence/display/CAMEL/TidyMarkup"
title="TidyMarkup">TidyMarkup</a> to unmarshal using Spring</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;camelContext id=<span class="code-quote">"camel"</span> xmlns=<span
class="code-quote">"http:<span class="code-comment">//camel.apache.org/schema/spring"</span>&gt;
</span>  &lt;route&gt;
    &lt;from uri=<span class="code-quote">"file:<span class="code-comment">//site/inbox"</span>/&gt;
</span>    &lt;unmarshal&gt;
      &lt;tidyMarkup/&gt;
    &lt;/unmarshal&gt;
    &lt;to uri=<span class="code-quote">"file:<span class="code-comment">//site/blogs"</span>/&gt;
</span>  &lt;/route&gt;
&lt;/camelContext&gt;
</pre>
</div></div>


<h3><a name="TidyMarkup-Dependencies"></a>Dependencies</h3>

<p>To use TidyMarkup in your camel routes you need to add the a dependency on <b>camel-tagsoup</b>
which implements this data format. </p>

<p>If you use maven you could just add the following to your pom.xml, substituting the
version number for the latest &amp; greatest release (see <a href="/confluence/display/CAMEL/Download"
title="Download">the download page for the latest versions</a>).</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;dependency&gt;
  &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
  &lt;artifactId&gt;camel-tagsoup&lt;/artifactId&gt;
  &lt;version&gt;1.6.0&lt;/version&gt;
&lt;/dependency&gt;
</pre>
</div></div>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CAMEL/TidyMarkup">View Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=107981&revisedVersion=5&originalVersion=4">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CAMEL/TidyMarkup?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message