Remove Empty XML Nodes from XMLPort in NAV

XMLPort is a nice tool that allows you quickly import and export xml files.   The tool has some shortcomings, but there is always a work around it.

For an implementation recently  I had to export an xml and it could not have empty xml nodes.  For example.  Bellow is an xml file created by xmlport


      <Title>When the moon is low</Title>
      <Author>Nadia Hashimi</Author>


as you can see above the <Summary></Summary>  is empty and there is no way in XMLPORT to remove this node.


The workaround is to add post processing process that removes the nodes from xml file. 


xmlDoc := xmlDoc.XmlDocument;

XMLNodeList := xmlDoc.SelectNodes('//Summary[. = ""]');
FOR i := 0 TO XMLNodeList.Count - 1 DO BEGIN
   XMLNode := XMLNodeList.Item(i);



Xmlport has a property for each line called MinOccurs  But it only works for importing file.  I wish they would have a new property or add to this property to not write the node if it's empty.