Question

xfMAP extract parent attribute

  • 27 February 2019
  • 9 replies
  • 7 views

Badge

Hi to all,

I have following part of XML:

<field name="ROZL_SK" conditionName="skrinNN">

<webEditable>0</webEditable>

</field>

<field name="CISLO" conditionName="skrinNN">

<webEditable>0</webEditable>

<nullable>0</nullable>

</field>

<field name="SJZ_ZAR">

<editable>0</editable>

<nullable>0</nullable>

</field>

<field name="DOD_ROZL" conditionName="skrinNN">

<webEditable>0</webEditable>

</field>

 

and prepared xfMap script:

 

<?xml version="1.0"?>

<xfMap>

<feature-map multi-feature-construction="true">

<mapping match="field">

<feature-type><extract expr="@name"/></feature-type>

</mapping>

</feature-map>

<feature-content-map>

<attributes>

<attribute><name><literal expr="ConditionName"/></name>

<value><extract expr="@conditionName"/></value></attribute>

</attributes>

<mapping match="nullable">

<attributes><attribute><name><literal expr="Nullable"/></name>

<value><extract expr="."/></value>

</attribute>

</attributes>

</mapping>

<mapping match="editable">

<attributes>

<attribute><name><literal expr="Editable"/></name>

<value><extract expr="."/></value>

</attribute>

</attributes>

</mapping>

<mapping match="webEditable">

<attributes>

<attribute><name><literal expr="Web Editable"/></name>

<value><extract expr="."/></value>

</attribute>

</attributes>

</mapping>

</feature-content-map>

</xfMap>

 

but I'm not able to get attribute conditionName in field element.

Can help me anyone?

Thanks


9 replies

Badge +16

Hi @gertner,

Any specific reason for using a xfMap instead of Feature Paths?

Also I have noticed that using the sample you provided with the XML reader returns an error, so I have corrected the XML and now all the values are available reading the file with Feature Paths.

Hope this helps,

Itay

Badge

Hi @gertner,

Any specific reason for using a xfMap instead of Feature Paths?

Also I have noticed that using the sample you provided with the XML reader returns an error, so I have corrected the XML and now all the values are available reading the file with Feature Paths.

Hope this helps,

Itay

Hi itay, I have to use Data Interoperability Tool for ESRI ArcGIS. This tool is compatible to FME Workbench version where Feature Paths is not supported ...

Userlevel 2
Badge +17

Hi @gertner,

Any specific reason for using a xfMap instead of Feature Paths?

Also I have noticed that using the sample you provided with the XML reader returns an error, so I have corrected the XML and now all the values are available reading the file with Feature Paths.

Hope this helps,

Itay

Surprising. Doesn't the XML reader in Esri Data Interoperability Extension have the Feature Paths option?

Badge

Hello takashi,

the source XML is stored in an atribute in ESRI table. I have to read this attribute using ESRI Geodatabase Reader and than parse it. I tried to use XML Flattener and XMLFeatureMapper ...

There are specific problems to parse:

<field name="NAZEV_ROZVODNA" conditionName="venovniRucni,venovniVzduchove">

<webEditable>0</webEditable>

<nullable>0</nullable>

<webEditable roles="KL13">1</webEditable>

</field>

Twice webEditable attribute ... that means restrictions -

in this case this attribute is not editable in WEB app for all users without users with KL13 role.

 

The result should be row in xls:

field name condition namenullableeditable web app yeseditable web app no

 

NAZEV_ROZVODNAvenovniRucni,venovniVzduchove

 

NOKL13ALL

 

 

Thanks for your response.

Badge

@takashi answer see below

Userlevel 2
Badge +17

@takashi answer see below

Does the <field> element always contain two <webeditable> elements?

Userlevel 2
Badge +17

@takashi answer see below

Is the value of first webEditable always 0?

Does the second webEditable always have "roles" attribute?

Badge

Hi @gertner,

Any specific reason for using a xfMap instead of Feature Paths?

Also I have noticed that using the sample you provided with the XML reader returns an error, so I have corrected the XML and now all the values are available reading the file with Feature Paths.

Hope this helps,

Itay

My answer to itay wasn´t correct ... I can't use (or I don't know how to) XML reader because the XML file is stored in ESRI table in specific attribute ...

Badge

Solved:

<?xml version="1.0"?>

<xfMap>

<feature-map multi-feature-construction="true">

<mapping match="field">

<feature-type>

<extract expr="@name"/>

<literal expr=";" />

<extract expr="@conditionName"/>

</feature-type>

</mapping>

</feature-map>

<feature-content-map>

<mapping match="nullable">

<attributes>

<attribute>

<name>

<literal expr="_Nullable"/>

</name>

<value>

<extract expr="."/>

</value>

</attribute>

</attributes>

</mapping>

<mapping match="editable">

<attributes>

<attribute type="list">

<name>

<literal expr="_Editable"/>

</name>

<value>

<extract expr="."/>

</value>

</attribute>

<attribute type="list">

<name>

<literal expr="_EditableRole"/>

</name>

<value>

<!--<extract expr="@roles"/>-->

<comparison lhs="">

<arg name="rhs"><extract expr="@roles"/></arg>

<arg name="success"><literal expr="ALL"/></arg>

<arg name="failure"><extract expr="@roles"/></arg>

</comparison>

</value>

</attribute>

</attributes>

</mapping>

<mapping match="webEditable">

<attributes>

<attribute type="list">

<name>

<literal expr="_WebEditable"/>

</name>

<value>

<extract expr="."/>

</value>

</attribute>

<attribute type="list">

<name>

<literal expr="_WebEditableRole"/>

</name>

<value>

<!--<extract expr="@roles"/>-->

<comparison lhs="">

<arg name="rhs"><extract expr="@roles"/></arg>

<arg name="success"><literal expr="ALL"/></arg>

<arg name="failure"><extract expr="@roles"/></arg>

</comparison>

</value>

</attribute>

</attributes>

</mapping>

</feature-content-map>

</xfMap>

Reply