4.3.4.10. ServingXML
File sample
Below is a sample of Serving Xml file:
<sx:resources xmlns:sx="http://www.servingxml.com/core"> <sx:service id="countries"> <sx:serialize> <sx:transform> <sx:content ref="countries"/> </sx:transform> </sx:serialize> </sx:service> <sx:recordContent id="countries"> <sx:flatFileReader> <sx:urlSource url="data/countries.csv"/> <sx:flatFile ref="countriesFile"/> </sx:flatFileReader> <sx:recordMapping ref="countriesToXmlMapping"/> </sx:recordContent> <sx:flatFile id="countriesFile"> <sx:flatFileHeader lineCount="1"/> <sx:flatFileBody> <sx:flatRecordType name="country"> <sx:fieldDelimiter value=","/> <sx:delimitedField name="code"/> <sx:delimitedField name="name"/> </sx:flatRecordType> </sx:flatFileBody> </sx:flatFile> <sx:recordMapping id="countriesToXmlMapping"> <countries> <sx:onRecord> <country> <sx:fieldElementMap field="name" element="countryName"/> <sx:fieldAttributeMap field="code" attribute="countryCode"/> </country> </sx:onRecord> </countries> </sx:recordMapping> </sx:resources>
Below is a sample of an Xml file:
<?xml version="1.0" encoding="utf-8"?> <countries> <country countryCode="BE"> <countryName>Belgium</countryName> </country> <country countryCode="FR"> <countryName>France</countryName> </country> <country countryCode="IT"> <countryName>Italy</countryName> </country> </countries>
The following properties are available: