I recognized that the XMLXQueryUpdater can be used to update not only an XML document but also the schema of the input feature.
Example from Extract attributes from XML attribute:
Assuming that the source XML is:
<SHD> <feature datadefinitie="Sleutels" code="SLEUTELS"> <attribuut naam="gisobjectnummeer">105963</attribuut> </feature> <feature datadefinitie="IMG" code="SHDV"> <attribuut naam="type">muur</attribuut> <attribuut naam="IMGEO status">bestaand</attribuut> <attribuut naam="In onderzoek">Nee</attribuut> <attribuut naam="relatieveHoogteligging">0</attribuut> <attribuut naam="identificatie">P0027.cdffbb11ae7c4f56a96a</attribuut> <attribuut naam="tijadstipRegistratie">20170626172844000</attribuut> </feature> <feature datadefinitie="GBK_LKI" code="C"></feature> </SHD>
An XMLXQueryUpdater with this small XQuery expression extracts pairs of attribute name and value from the source XML and adds the attributes to the input feature.
for $a in //attribuut return fme:set-attribute($a/@naam, $a/text())
I think the XMLXQueryUpdater (XQuery expressions) would be a powerful and elegant solution in some scenarios such as the example above. However, depending on the situation, you have to add some other transformers e.g. AttributeExposer, AttributeRemover to clean up the feature.
It might be nice if these improvements would be done on the XMLXQueryUpdater.
- Add some new XQuery functions to process feature attributes. e.g. "fme:remove-attribute" and "fme:remove-list-attribute".
- Add "Attributes to Expose", "Attributes to Hide", and "Lists to Hide" parameters.
- Make the "Result Attribute" parameter optional.
- Rename the output ports (QueryResults -> Output, Invalid -> <Rejected>).