You might try qualifying the XPath with the namespace:
queryHans.selectSingleNode("q:@UserName").text = userName;
It's generally a good idea to test the result of a selectSingleNode method
to see if it contains a node or not. It returns null if the XPath fails to
find a node.
oNode = queryHans.selectSingleNode("q:@UserName").text = userName;
if (oNode != null){
oNode.text = userName + "";
}
Regards,
Mike Sharp
> I'm trying to do the same thing in my code:
>
[quoted text clipped - 7 lines]
>
> var queryHans =
Document.DOM.selectSingleNode("/my:myFields/my:queryFields/q:TblStaffDetails
"
> );
>
[quoted text clipped - 7 lines]
>
> Anyone got any ideas why not?
Enterprise Andy - 20 Apr 2005 09:10 GMT
All I needed to do was to changed the 'my' to 'dfs' and the code works!
Working code is as follows (Just to help people out if they have the same
problems as me!):
function XDocument::OnLoad(eventObj)
{
var objNetwork = new ActiveXObject("WScript.Network");
userName = objNetwork.UserName;
var queryHans =
Document.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:TblStaffDetails"
);
queryHans.selectSingleNode("@UserName").text = userName;
}