1
Reply

Azure market place XML shreding

peter

peter

Apr 9 2012 6:21 AM
1.9k
Hi,
I am trying to find the balance of the MSFT translator from the azure marketplace b looking at the uri
https://api.datamarket.azure.com/Services/My/Datasets

So a code snippet is :
Uri targetUri = new Uri("https://api.datamarket.azure.com/Services/My/Datasets");  
NetworkCredential myCredentials = new NetworkCredential(myUserName, myAzureKey);             
WebClient
 myWebClient = new WebClient();            
myWebClient.Credentials = myCredentials;            
myWebClient.BaseAddress = myUrl;                            
string myResonse = myWebClient.DownloadString(targetUri);                 
XmlDocument myXmlDoc = new XmlDocument();                
myXmlDoc.LoadXml(myResonse);                
// Set up namespace manager for XPath                  
XmlNamespaceManager myXmlNamespaceManager = new XmlNamespaceManager(myXmlDoc.NameTable);                
myXmlNamespaceManager.AddNamespace("base""https://api.datamarket.azure.com/Services.svc/My/Datasets");                
myXmlNamespaceManager.AddNamespace("d""http://schemas.microsoft.com/ado/2007/08/dataservices");                
myXmlNamespaceManager.AddNamespace("m""http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");                
myXmlNamespaceManager.AddNamespace("""http://www.w3.org/2005/Atom");                 
XmlNode myNode = myXmlDoc.LastChild;                
XmlNodeList myXmlNodeList = myNode.SelectNodes("entry/content/m:properties", myXmlNamespaceManager);                
.....

But the nodelist is empty so I cannot get to the the d:ResourceBalance atribute in the list of data services subscribed too.

Has anyone suggestions as to how I can walk the DOM to get to this entry - or what Im doing wrong ?

Cheers

Peter

Answers (1)