Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing Amazon s3 bucket listing with C# XmlDocument (Unity3d)
    primarykey
    data
    text
    <p><strong>Disclaimer</strong>: This issue is happening within a Unity application, but AFAIK, this is more of a C# issue than a Unity issue...</p> <p>I am trying to use <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx" rel="nofollow">System.Xml.XmlDocument</a> to parse <a href="http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGET.html" rel="nofollow">an Amazon S3 bucket listing</a>. <a href="https://s3.amazonaws.com/themall/" rel="nofollow">Here is my bucket xml</a>. I am using an example that I found in <a href="http://csharp.net-tutorials.com/xml/using-xpath-with-the-xmldocument-class/" rel="nofollow">a C# Xml tutorial</a>. </p> <pre><code>XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("http://rss.cnn.com/rss/edition_world.rss"); XmlNode titleNode = xmlDoc.SelectSingleNode("//rss/channel/title"); if(titleNode != null) Debug.Log(titleNode.InnerText); </code></pre> <p>This works fine for that particular XML file, but when I put my stuff in there:</p> <pre><code>XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("https://s3.amazonaws.com/themall/"); Debug.Log ( xmlDoc.InnerXml ); XmlNode nameNode = xmlDoc.SelectSingleNode("//Name"); if(nameNode != null) Debug.Log(nameNode.InnerText); </code></pre> <p>I get the raw XML in the console, so I know it is being downloaded successfully, but even the simplest XPath produces no results! </p> <p>My only theory is that perhaps it has something to do with the default namespace in my XML? Do I need to tell XmlDocument about that somehow? Here is my root tag:</p> <pre><code>&lt;ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"&gt; </code></pre> <p>I have tried creating an XmlNamespaceManager and using it with all of my calls to "SelectSingleNode", but that doesn't seem to work either. </p> <pre><code>XPathNavigator nav = xmlDoc.CreateNavigator(); XmlNamespaceManager ns = new XmlNamespaceManager(nav.NameTable); ns.AddNamespace(System.String.Empty, "http://s3.amazonaws.com/doc/2006-03-01/"); </code></pre> <p>What am I doing wrong?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload