Trying to navigate the XML Response received following a SearchBykeyword request, I was not able to select /CompanySearchResult/resultSet. However, if I save the XML Response and comment-out the xmlns namespace attributes, the select will work.
In .Net, is it necessary to reference the namespace and use a NameSpaceManager? If so, would you have an example?
Having gone this route before, you do have to use the NameSpaceManager. I believe it is as simple as creating a new NameSpaceManager, then adding both the namespace prefixs of the elements and the URL of the schema to the manager, and then associating the manager to the XmlDocument object. XPATH works after that. I would have to dig up the example, but it really isn't difficult. Look on the web for NameSpaceManager examples and apply them to this problem.
Thanks, Technature. I came the the same conclusion after a while and experimenting with the NameSpaceManager, but I'm glad to get your confirmation that this is necessary.
What I ended up doing is using the NameSpaceManager but not XPath, just using the (fairly awkward) methods of XMLDocument to select the element desired. I will be looking at using XPath if our trial application is successful.
Thanks Technature for the help. Sam, let me know if you have any API-related issues. Unfortunately, I will not be as much help on the .NET specifics of calling the API as my main focus is helping users with the specifics of the API calls (such as the XML request/response and interpretations of the data).
My trial application is working great at the moment. Let me know if you would like the .Net C# code - I do not want to post it prior to your indication this will be ok, and you may want to look it over before posting to the forum.
Right now we don't have an easy way to post files to the forum, so I think if you want to send it to me (I will email you), that is fine, but I don't have a way to easily share it as "community generated software" or something of that nature. It is really great you want to share it with everyone, and I would be happy to send it out should anyone else want to see it.
Trying to navigate the XML Response received following a SearchBykeyword request, I was not able to select /CompanySearchResult/resultSet. However, if I save the XML Response and comment-out the xmlns namespace attributes, the select will work.
In .Net, is it necessary to reference the namespace and use a NameSpaceManager? If so, would you have an example?
Thanks
Technature – 12 months ago
Having gone this route before, you do have to use the NameSpaceManager. I believe it is as simple as creating a new NameSpaceManager, then adding both the namespace prefixs of the elements and the URL of the schema to the manager, and then associating the manager to the XmlDocument object. XPATH works after that. I would have to dig up the example, but it really isn't difficult. Look on the web for NameSpaceManager examples and apply them to this problem.
Sam – 12 months ago
Thanks, Technature. I came the the same conclusion after a while and experimenting with the NameSpaceManager, but I'm glad to get your confirmation that this is necessary.
What I ended up doing is using the NameSpaceManager but not XPath, just using the (fairly awkward) methods of XMLDocument to select the element desired. I will be looking at using XPath if our trial application is successful.
Elliot – 12 months ago
Thanks Technature for the help. Sam, let me know if you have any API-related issues. Unfortunately, I will not be as much help on the .NET specifics of calling the API as my main focus is helping users with the specifics of the API calls (such as the XML request/response and interpretations of the data).
Elliot
Sam – 12 months ago
Elliot and Technature: Thanks for your help.
My trial application is working great at the moment. Let me know if you would like the .Net C# code - I do not want to post it prior to your indication this will be ok, and you may want to look it over before posting to the forum.
Sam
Elliot – 12 months ago
Right now we don't have an easy way to post files to the forum, so I think if you want to send it to me (I will email you), that is fine, but I don't have a way to easily share it as "community generated software" or something of that nature. It is really great you want to share it with everyone, and I would be happy to send it out should anyone else want to see it.
Elliot