on demand here is the code to skip empty xml-tags after using a xml-port:
DeleteEmptyXMLNodes(VAR XMLNode : Automation "'Microsoft XML,v3.0'.IXMLDOMNode")
IF XMLNode.nodeTypeString = 'element' THEN BEGIN
IF (XMLNode.hasChildNodes = FALSE) THEN BEGIN
IF (XMLNode.xml = '<' + XMLNode.nodeName + '/>') THEN
XMLNode := XMLNode.parentNode.removeChild(XMLNode)
END ELSE BEGIN
XMLDomNodeList := XMLNode.childNodes;
FOR i := 1 TO XMLDomNodeList.length DO BEGIN
XMLChildNode :=XMLDomNodeList.nextNode();
DeleteEmptyXMLNodes(XMLChildNode);
END;
END;
END;
following local variables:
XMLChildNode Automation 'Microsoft XML, v3.0'.IXMLDOMNode
XMLDomNodeList Automation 'Microsoft XML, v3.0'.IXMLDOMNodeList
i Integer
you can use it with an existing xml-document like that:
CurrNode Automation 'Microsoft XML, v3.0'.IXMLDOMNode
CurrNode := XMLDOMDocument.documentElement;
DeleteEmptyXMLNodes(CurrNode);
sorry that the code isnt indented but html cannot be turned on for my posts ?!?
0
Comments
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!