You are here: Popular Formats > XML (Extensible Markup Language) Reader/Writer > Mapping File Reference > Writer Example
Example 1
The following FME mapping file reads from an Esri Shapefile and translates into XML using the XML Writer.
READER_TYPE SHAPE WRITER_TYPE XML SHAPE_DATASET C:\work\data\shape\MEXICO XML_DATASET C:\tmp\out.xml XML_WRAP_TABLES yes XML_TABLE_WRAPPER_PREFIX prefix- XML_TABLE_WRAPPER_SUFFIX -suffix XML_TARGET_NS_PREFIX xf XML_GENERATE_ROW_ID yes XML_ROW_ID_ATTR_NAME myid XML_ROW_ID_PREFIX someid XML_TABLES_SEQUENCE "states cities" XML_APPLY_STYLESHEET C:\tmp\stylesheet.xsl XML_DEF cities \ NAME xml_char(51) \ CAPITAL xml_char(1) \ STATE_NAME xml_char(25) \ POPULATION xml_decimal(11,0) XML_DEF rivers \ NAME xml_char(40) \ SYSTEM xml_char(40) XML_DEF roads \ LENGTH xml_decimal(16,3) \ TYPE xml_char(40) \ ADMN_CLASS xml_char(20) \ TOLL_RD xml_char(1) \ RTE_NUM1 xml_char(3) \ RTE_NUM2 xml_char(3) \ ROUTE xml_char(40) XML_DEF states \ AREA xml_decimal(16,3) \ CODE xml_char(4) \ NAME xml_char(25) \ POP1990 xml_decimal(11,0) \ POP90_SQMI xml_decimal(20,6) \ P_URBAN90 xml_decimal(20,6) \ P_ING_LANG xml_decimal(20,6) \ P_EMPL_SEC xml_decimal(20,6) \ HSE_UNIT90 xml_decimal(11,0) # ------------------------------------------------------------------------- SHAPE cities \ NAME %NAME \ CAPITAL %CAPITAL \ STATE_NAME %STATE_NAME \ POPULATION %POPULATION XML cities \ xml_type xml_point \ NAME %NAME \ CAPITAL %CAPITAL \ STATE_NAME %STATE_NAME \ POPULATION %POPULATION # ------------------------------------------------------------------------- SHAPE rivers \ NAME %NAME \ SYSTEM %SYSTEM XML rivers \ xml_type xml_line \ NAME %NAME \ SYSTEM %SYSTEM # ------------------------------------------------------------------------- SHAPE roads \ LENGTH %LENGTH \ TYPE %TYPE \ ADMN_CLASS %ADMN_CLASS \ TOLL_RD %TOLL_RD \ RTE_NUM1 %RTE_NUM1 \ RTE_NUM2 %RTE_NUM2 \ ROUTE %ROUTE XML roads \ xml_type xml_line \ LENGTH %LENGTH \ TYPE %TYPE \ ADMN_CLASS %ADMN_CLASS \ TOLL_RD %TOLL_RD \ RTE_NUM1 %RTE_NUM1 \ RTE_NUM2 %RTE_NUM2 \ ROUTE %ROUTE # ------------------------------------------------------------------------- SHAPE states \ AREA %AREA \ CODE %CODE \ NAME %NAME \ POP1990 %POP1990 \ POP90_SQMI %POP90_SQMI \ P_URBAN90 %P_URBAN90 \ P_ING_LANG %P_ING_LANG \ P_EMPL_SEC %P_EMPL_SEC \ HSE_UNIT90 %HSE_UNIT90 XML states \ xml_type xml_area \ AREA %AREA \ CODE %CODE \ NAME %NAME \ POP1990 %POP1990 \ POP90_SQMI %POP90_SQMI \ P_URBAN90 %P_URBAN90 \ P_ING_LANG %P_ING_LANG \ P_EMPL_SEC %P_EMPL_SEC \ HSE_UNIT90 %HSE_UNIT90