Navigation:  Advanced Topics > Reading and writing XML > Reading XML >

With XMLExtract

First of all, add the XMLExtract component. You will find it in Readers. Next, you need to set the following XMLExtract properties

 

File URL - that is the CustOrders.xml we created in Writing XML.
Schema - if you have one (use the XSD from Reading XML). If you do not have one, edit "Mapping", switch to the "Mapping"  tab and click "Generate XML Schema". Anyway, you do not have to use a schema at all as you can write the Mapping without one.
Mapping - if you have an XSD schema, the wizard scheme generates the Mapping XML. If you do not have a schema, write the Mapping code yourself or try to generate a schema from the source XML. In a few lines you will see the Mapping for our example.

 

XSDSchema

 

If you supply a schema then when you select the Mapping property and press '...' you will get the wizard you see above. Important is to select which elements you want to extract. You can see we have extracted all of it. You should then select each element (e.g "customer", "orders") and then on the right, assign the output to a Port. The above screenshot shows "orderdetails" selected and assigned to Port 2.

 

If you press then Source tab, you will see the Mapping code that is generated. If you did not have a schema, you would need to enter this yourself.

 

XMLMapping

 

Read  the Clover Manual  to get more information.

Here is a video showing how this is set up

 

 

 


PlayIcon

[4:16]

XML Reading

Extract the customers, orders and orderdetails records from XML