Skip to main content

I have a known structure of an XML file/feed and am using an xfmap file to map attributes. The XML feed doesn't always have all of the fields in their feed. Is there a way to populate a reader attributes from an xfmap file?

Hi @runneals, I think the <schema-type> element (an optional child element of an xfMap) is what you are looking for.
See this documentation: XML Reader/Writer > xfMap > FME Schema Features

There are three ways (child elements) to implement the <schema-type>, but probably learning the <inline> element would be a good starting point. See also here: Inline FME Schema Features


Hi @runneals, I think the <schema-type> element (an optional child element of an xfMap) is what you are looking for.
See this documentation: XML Reader/Writer > xfMap > FME Schema Features

There are three ways (child elements) to implement the <schema-type>, but probably learning the <inline> element would be a good starting point. See also here: Inline FME Schema Features

Thanks @takashi! EXACTLY what I was looking for. No wonder you are one of the user community champions 😉 Now to figure out how to implement it.
@DeanAtSafe, I heard you're the FME XML pro 😉

Where I need to put the schema-type tags? Do I put it before the feature-map and the mapping tags? Also what do I put in for the schema-feature type="..." Is that related to the feature-map that I define?

TIA


@DeanAtSafe, I heard you're the FME XML pro 😉

Where I need to put the schema-type tags? Do I put it before the feature-map and the mapping tags? Also what do I put in for the schema-feature type="..." Is that related to the feature-map that I define?

TIA

Hello @runneals,

 

I believe you will find an example in the following link that will show you the location of the schema-type tags. http://docs.safe.com/fme/2018.0/html/FME_Desktop_Documentation/FME_ReadersWriters/xml/Inline_FME_Schema_Featur.htm

 

 

The below picture shows the schema-feature type, along with the attributes using the inline method. This is taken directly from the above link.

 

 


Hello @runneals,

 

I believe you will find an example in the following link that will show you the location of the schema-type tags. http://docs.safe.com/fme/2018.0/html/FME_Desktop_Documentation/FME_ReadersWriters/xml/Inline_FME_Schema_Featur.htm

 

 

The below picture shows the schema-feature type, along with the attributes using the inline method. This is taken directly from the above link.

 

 

@trentatsafe I saw that sample, but I guess the xmp file in this one gave me my answer.

 

Now that I have that figured out, is it best practices to define all the 50-75 fields as xml_char(254)? Won't that negatively impact performance? We have like 5-6 of these that run every 5 minutes, so performance is pretty important.
@DeanAtSafe, I heard you're the FME XML pro 😉

Where I need to put the schema-type tags? Do I put it before the feature-map and the mapping tags? Also what do I put in for the schema-feature type="..." Is that related to the feature-map that I define?

TIA

Hi @runneals,

The xml_char(254) will not affect the length of the attributes read from XML into FME or output to XML. This only affects what FME reads as schema features or writes to the application schema. XML is a structured text document so all values are essentially strings delimited by XML tags. FME will not buffer or truncate these according to the data type or field width setting in the feature type.

Where these come into play is with feature type schema definitions and validation. If you were to read schema from an XSD or via an XFMap, and use that to create a feature type, then the data types for the feature type definitions can be read from that schema feature. Then if you translate to another format that does enforce field data type and width, that may affect your result in that format. Also, if you try to validate a given XML file against an XSD and the field data types violate the data types in the schema definition, then you will get a validation error. So if you are concerned that the data types might be too wide in your case, you only need to check / edit the destination feature type field widths.


Reply