Difference between revisions of "XMLMerge"

From GreenVulcano Wiki
Jump to: navigation, search
(Created page with "==Description== The element provides the configuration parameters to manage XML documenti merging. Contains a list of MergeInfo elements, the first one defines th...")
 
Line 44: Line 44:
 
with the following configuration:
 
with the following configuration:
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
<Merge>
+
<XMLMerge>
 
     <MergeInfo source="document1"/>
 
     <MergeInfo source="document1"/>
 
     <MergeInfo source="document2"
 
     <MergeInfo source="document2"
Line 52: Line 52:
 
               xpath-source="/doc3/element"
 
               xpath-source="/doc3/element"
 
               xpath-dest="/doc" />
 
               xpath-dest="/doc" />
</Merge>
+
</XMLMerge>
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 14:50, 2 January 2015

Description

The element provides the configuration parameters to manage XML documenti merging.

Contains a list of MergeInfo elements, the first one defines the target document on which merge the data.

MergeInfo

Defines the information for retrieving some XML Nodes from a document and past them on a target document.

Its attributes are:

Attribute Type Description
source required Source document name.
xpath-source optional Source document XPath selector.
xpath-dest optional Destination document parent Node's XPath selector.

Example

As an example lets have 'document1':

<doc>
    <element>some text</element>
</doc>

and 'document2':

<doc2>
    <element>some text 2</element>
    <other-element>some other text</other-element>
</doc2>

and 'document3':

<doc3>
    <element>some text 3</element>
    <other-element>some other text</other-element>
</doc3>

with the following configuration:

<XMLMerge>
    <MergeInfo source="document1"/>
    <MergeInfo source="document2"
               xpath-source="/doc2/element"
               xpath-dest="/doc" />
    <MergeInfo source="document3"
               xpath-source="/doc3/element"
               xpath-dest="/doc" />
</XMLMerge>

we get as output the following XML document:

<doc>
    <element>some text</element>
    <element>some text 2</element>
    <element>some text 3</element>
</doc>