finding whether a particular xml node is existing or not

dilipkinthadadilipkinthada Member Posts: 11
Hi All.

I want to check whether a particular xml node is existing or not in an xml doucment?
How to find it?


Reg
Dilip

Comments

  • hemantOnehemantOne Member Posts: 98
    I think selectSingleNode will help u. U have to create automation variable Node('Microsoft XML, v3.0'.IXMLDOMNode subtype) to get the function selectsingleNode and find return parameter.

    XMLNode := Node.selectSingleNode('Parameters/Parameter[Name="' + Parameter + '"]/Value');
    Regards,
    Hemant
    They can conquer who believe they can
    .
  • strykstryk Member Posts: 645
    hemantOne wrote:
    I think selectSingleNode will help u. U have to create automation variable Node('Microsoft XML, v3.0'.IXMLDOMNode subtype) to get the function selectsingleNode and find return parameter.

    XMLNode := Node.selectSingleNode('Parameters/Parameter[Name="' + Parameter + '"]/Value');
    Yes, and then you could use the ISCLEAR method to check if this node is empty or not:
    IF NOT ISCLEAR(XMLNode) THEN   // Node exists
    ...
    
    Jörg A. Stryk (MVP - Dynamics NAV)
    NAV/SQL Performance Optimization & Troubleshooting
    STRYK System Improvement
    The Blog - The Book - The Tool
  • dilipkinthadadilipkinthada Member Posts: 11
    Hi Hemant and stryk

    I have used ur code and it works fine.
    Thanks a lot

    Regards
    Dilip.
Sign In or Register to comment.