Partager via


Snippet on Traversing XML

A while ago I asked someone to explain to me when to use ".", "/" and the combination of both in order to get to where I want to be in the XML tree.   This is what they sent me:

You can continue to reference the node that you are listening on (using OnAfterChange) using eventObj.Site

If your data source is:

<A>

    <B>

        <C/>

        <D/>

    <B>

    <B>

        <C/>

        <D/>

    </B>

</A>

 

and your OnAfterChange is defined on C, then eventObj.Site will return the node C. eventObj.Site.selectSingleNode("../D") will return the D under the same B as the C that fired your OnAfterChange. Hope that clarifies it a bit more.

 

If it makes sense to you, then great. If not, then you and me are in the same boat :-).