Question

Cannot update XML-file using XMLUpdater when XML input is more complex

  • 18 August 2018
  • 5 replies
  • 21 views

Badge

My aim is to update the creation date in the metadata of a feature class in ArcSDE using XMLUpdater.

However, with the workspace I've build so far, the value is not changed.

At first I thought I might have the XML path wrong. But I did some testing and found that when I simplify the XML (leave some nodes out that are further on in the XML file) everything works fine.

So my attached workspace works fine when I use the attribute geodb_metadata_string_simplified as the XML input, but it doesn't when I use geodb_metadata_string. Do you know what might cause this problem?


5 replies

Userlevel 2
Badge +17

Hi @friesewoudloper, I was able to reproduce the symptom, with FME 2018.1.0.0 build 18520.

In my observation, the XMLUpdater seems to consider the default namespace "http://www.isotc211.org/2005/gmd" which is declared in the "MD_Metadata" element as the default namespace across the entire XML document. If my observation was correct, it would be a bug. Could you please check this? > @DeanAtSafe

A workaround in the interim, you can use the XMLXQueryUpdater instead.

XQuery Expression:

replace value of node /metadata/Esri/CreaDate with '20180818'

0684Q00000ArKcfQAF.png

Userlevel 2
Badge +17

Hi @friesewoudloper, I was able to reproduce the symptom, with FME 2018.1.0.0 build 18520.

In my observation, the XMLUpdater seems to consider the default namespace "http://www.isotc211.org/2005/gmd" which is declared in the "MD_Metadata" element as the default namespace across the entire XML document. If my observation was correct, it would be a bug. Could you please check this? > @DeanAtSafe

A workaround in the interim, you can use the XMLXQueryUpdater instead.

XQuery Expression:

replace value of node /metadata/Esri/CreaDate with '20180818'

0684Q00000ArKcfQAF.png

This workspace illustrates what's the issue on namespace handling in the XMLUpdater.

 

b18520-xmlupdater-issues-repro.fmw (FME 2018.1.0.0)

 

 

Userlevel 2
Badge +17

Hi @friesewoudloper, I was able to reproduce the symptom, with FME 2018.1.0.0 build 18520.

In my observation, the XMLUpdater seems to consider the default namespace "http://www.isotc211.org/2005/gmd" which is declared in the "MD_Metadata" element as the default namespace across the entire XML document. If my observation was correct, it would be a bug. Could you please check this? > @DeanAtSafe

A workaround in the interim, you can use the XMLXQueryUpdater instead.

XQuery Expression:

replace value of node /metadata/Esri/CreaDate with '20180818'

0684Q00000ArKcfQAF.png

Another workaround. The prefix "*:" resolves any namespace, so this XPath set to the XMLUpdater works as expected in this case.

 

/*:metadata/*:Esri/*:CreaDate

0684Q00000ArMNwQAN.png

Badge

Thank you very much @takashi!

I have the problem in FME Desktop 2018.0.0.2 (20180414 - Build 18301 - WIN32). 

I have a second question: I'd like to generate the xpath dynamically based upon a column ('Attribuut') in an Excel file. However, when I choose this attribute in the text editor for the XML Path, the generated code is wrong. It is:

//*:featureAttribute[*:name/text() = 'fme:get-attribute("Attribuut")']/*:definition

where it should be:

//*:featureAttribute[*:name/text() = '@Value(Attribuut)']/*:definition

I can change this myself and everything works fine. Is this also a bug, or does FME generate the xpath as one might expect? Is it something I do wrong?

0684Q00000ArL01QAF.png

Badge

Thank you very much @takashi!

I have the problem in FME Desktop 2018.0.0.2 (20180414 - Build 18301 - WIN32). 

I have a second question: I'd like to generate the xpath dynamically based upon a column ('Attribuut') in an Excel file. However, when I choose this attribute in the text editor for the XML Path, the generated code is wrong. It is:

//*:featureAttribute[*:name/text() = 'fme:get-attribute("Attribuut")']/*:definition

where it should be:

//*:featureAttribute[*:name/text() = '@Value(Attribuut)']/*:definition

I can change this myself and everything works fine. Is this also a bug, or does FME generate the xpath as one might expect? Is it something I do wrong?

0684Q00000ArL01QAF.png

I'm sorry, I should probably post my second question seperately. I will do so.

 

 

Reply