You are here: Popular Formats > XML (Extensible Markup Language) Reader/Writer > xfMap > FME架构功能 > Generating FME Schema Features

Generating FME Schema Features

The XML Reader can switch the given xfMap and XML input document when it is requested for schema features. This can be done through the元素element.

Theelement contains two required attributes: thexfMapand thedocumentattributes. They specify the xfMap and XML document to used when XML Reader is requested for schema features. In other words, it is possible for the XML Reader to ignore the given xfMap and input XML document by using theelement.

Consider the following input XML document. (It is the samepoints1.xmldocument used earlier and reproduced here for convenience.)

points1.xml

    0.324 0.233 0.596      0.874 0.948 0.554    

The following xfMap document,generate_points1.xmp, maps the elements in thepoints1.xmldocument into FME features:

generate_points1.xmp

   This xfMap document maps elements from the points1.xml document.   <generate xfMap="generate_points1_schemas.xmp" document="generate_points1_schemas.xml"/>                                      

When thepoints1.xmlandgenerate_points1.xmpare fed into the XML Reader and FME data features are requested, then the following features are output:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++ ++ ++特征类型:`point'属性(字符串):`color'具有值`0.324,0.233,0.596'属性(String):`fme_geometry'具有值`fme_point'属性(字符串):`number'具有值`0'属性(字符串):`xml_type'有值`xml_point'几何类型:point(1)坐标数:1  - 坐标尺寸:2  - 坐标系:`'(10,0)============================================================+++++++++++++++++++++++++++++++++++++++++++++++!++++++++++++++++++++++++++++++++++++++++功能类型:`点”属性(字符串):“颜色”有值`0.874,0.948,0.554'属性(String):`fme_geometry'有值`fme_point'属性(字符串):`number'具有值`1'属性(字符串):`xml_type'具有值`XML_Point'几何类型:点(1)坐标数:1  - 坐标尺寸:2  - 坐标系:`'(5,5)==================================================================

Notice that thegenerate_points1.xmpxfMap contains aelement. Its child element is the元素,其属性,xfMapanddocumentattributes, indicate the xfMap (generate_points1_schemas.xmp) and XML document (generate_points1_schemas.xml) to be used when the XML Reader is requested for schema features.

Thegenerate_points1_schemas.xmldocument contains oneelement; this element describes the FME schema feature that we want for the FME data features that are constructed from thepoints1.xmldocument through thegenerate_points1.xmpxfMap.

generate_points1_schemas.xml

        

The usage of theelement requires the user to have knowledge of how schema features are represented in FME. Every FME schema feature must have anfme_geometry {}list attribute that lists the possible geometry types of a schema feature. For the XML Reader, the possible values for thefme_geometry {}list attribute are:xml_no_geom,xml_text,XML_POINT.,xml_line,xml_area, andxml_text. If a theme or feature type is capable of containing several geometries (for example, points, lines and areas), then thefme_geometry {}list attribute should contain 3 members:

fme_geometry{0} = “xml_point”
fme_geometry{1} = “xml_line”
fme_geometry{2} = “xml_area”

The type of user attribute, that is, the value of an attribute, must be one of the predefined FME types:xml_char(#),xml_int16,xml_int32,XML_REAL32.,xml_real64,xml_decimal(#,#), orxml_boolean.

The following xfMapgenerate_points1_schemas.xmpmaps theelement into an FME feature.

   This xfMap document maps elements from the generate_points1_schema.xml document.                       

Note:Nothing dictates that the xfMap generate_points1_schemas.xmp and the generate_points1_schemas.xml document should take the form of the example above. What is required when the element is used is that an FME feature constructed with the XML document (specified in the document attribute) with the xfMap (specified in the xfMap attribute) by the XML Reader conforms to the definition of an FME schema feature. The FME schema features constructed must contain a fme_geometry{} list attribute, and the attributes defined for the features must have values that equal one of the FME types: xml_char(#), xml_int16, xml_int32, xml_real32, xml_real64, xml_decimal(#,#), or xml_boolean.

The document attribute in the element may take the special value, #dataset, which instructs the XML Reader to keep given input XML document as the document used for generating the FME schema features.

Example:

<模式类型> <生成xfMap = " schemas.xmp” document=”#dataset”/> 

The #self token may be used for the xfMap attribute in the element. This instructs the XML Reader to use the current xfMap to generate FME schema features. Using #self allows the xfMap to refer to itself without explicitly knowing its filename.

Example: