You can use an xmlXQueryUpdater with a query like:
for $node in //OperatingTime
where $node =''
return (
delete node $node)
You can use an xmlXQueryUpdater with a query like:
for $node in //OperatingTime
where $node =''
return (
delete node $node)
Agree that the XMLXQueryUpdater can be used effectively here.
Just be aware that the "where" clause above may not work as expected depending on the format of source XML. For example, if the entire document is put on a single line and there is no excess spaces between elements, all OperatingTime elements will be removed.
I think this expression would be better If there could be such a case.
for $node in //OperatingTime
where count($node/child::*) = 0
return delete node $node
Or, the "child::" can be abbreviated, as in:
for $node in //OperatingTime
where count($node/*) = 0
return delete node $node
Agree that the XMLXQueryUpdater can be used effectively here.
Just be aware that the "where" clause above may not work as expected depending on the format of source XML. For example, if the entire document is put on a single line and there is no excess spaces between elements, all OperatingTime elements will be removed.
I think this expression would be better If there could be such a case.
for $node in //OperatingTime
where count($node/child::*) = 0
return delete node $node
Or, the "child::" can be abbreviated, as in:
for $node in //OperatingTime
where count($node/*) = 0
return delete node $node
I agree that`s it`s not the best clause in the general case.
I was thinking originally of using functx:has-empty-content
http://www.xqueryfunctions.com/xq/functx_has-empty-content.html
but I couldn`t get the syntax exactly right.
Thanks @jdh and @takashi!
So , how should I make the XMLXQueryUpdater work with xml file? Because as i am using it directly after the reader now, everything went into failed. I am attaching an example.xml similar to my original file.

Agree that the XMLXQueryUpdater can be used effectively here.
Just be aware that the "where" clause above may not work as expected depending on the format of source XML. For example, if the entire document is put on a single line and there is no excess spaces between elements, all OperatingTime elements will be removed.
I think this expression would be better If there could be such a case.
for $node in //OperatingTime
where count($node/child::*) = 0
return delete node $node
Or, the "child::" can be abbreviated, as in:
for $node in //OperatingTime
where count($node/*) = 0
return delete node $node
I'm afraid that FME doesn't bundle the Functx Function Library...
I'm afraid that FME doesn't bundle the Functx Function Library...
That would explain why I couldn't get it to work. I just figured it was my lack of skill in xquery.
Thanks @jdh and @takashi!
So , how should I make the XMLXQueryUpdater work with xml file? Because as i am using it directly after the reader now, everything went into failed. I am attaching an example.xml similar to my original file.

Don't read it in as a CSV.
You can use the XML reader, text file (whole file at once), or use a creator and in the XMLXQueryUpdater set the XML source to the file instead of an attribute containing the XML.
hoursoperationlist.xml
strip-hoursoperationlist.fmwI think XSLTProcessor with a simple stylesheet does the job.
strip-hoursoperationlist.fmwhoursoperationlist.xml
The links in my answer are broken, so I'll give it another try. I also include screenshots, just in case ;-)


