373.4. Spring または Blueprint DSL での基本的な使用法
<dataFormats>
ブロック内で、xmljson
要素を一意の ID で設定するだけです。
<dataFormats> <xmljson id="xmljson"/> <xmljson id="xmljsonWithOptions" forceTopLevelObject="true" trimSpaces="true" rootName="newRoot" skipNamespaces="true" removeNamespacePrefixes="true" expandableProperties="d e"/> </dataFormats>
次に、<marshal />
および <unmarshal />
DSL 内でデータ形式オブジェクトを参照するだけです。
<route> <from uri="direct:marshal"/> <marshal ref="xmljson"/> <to uri="mock:json" /> </route> <route> <from uri="direct:unmarshalWithOptions"/> <unmarshal ref="xmljsonWithOptions"/> <to uri="mock:xmlWithOptions"/> </route>
このコンポーネントの XML DSL オートコンプリートを有効にするのは簡単です。Spring DSL と Blueprint DSL のどちらを使用しているかに応じて、適切な スキーマの場所 を参照するだけです。このデータ形式は Camel 2.10 以降で使用できるため、そのバージョン以降のスキーマのみがこれらの新しい XML 要素と属性を含むことに注意してください。
Blueprint の構文は、Spring DSL の構文と同じです。正しい名前空間と schemaLocations が使用されていることを確認してください。