Having an xml file:
<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Contents>
    <Key>README</Key>
    <LastModified>2018-09-27T16:04:24.616Z</LastModified>
    <ETag>"00000000000000000000000000000000-1"</ETag>
    <Size>94</Size>
    <Owner>
      <ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
      <DisplayName/>
    </Owner>
    <StorageClass>STANDARD</StorageClass>
  </Contents>
  <Contents>
    <Key>file1.zip</Key>
    <LastModified>2009-09-13T16:09:35.000Z</LastModified>
    <ETag>"00000000000000000000000000000000-1"</ETag>
    <Size>170486537</Size>
    <Owner>
      <ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
      <DisplayName/>
    </Owner>
    <StorageClass>STANDARD</StorageClass>
  </Contents>
  <Contents>
    <Key>file2.zip.torrent</Key>
    <LastModified>2009-09-14T03:35:56.000Z</LastModified>
    <ETag>"00000000000000000000000000000000-1"</ETag>
    <Size>13884</Size>
    <Owner>
      <ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
      <DisplayName/>
    </Owner>
    <StorageClass>STANDARD</StorageClass>
  </Contents>
</ListBucketResult>
Now trying to extract with xmlstarlet:
xmlstarlet sel -t -c '//Key' dl.xml
gives back nothing. Same for
xmlstarlet sel -t -c '/ListBucket/Result' dl.xml
The only working selections are:
xmlstarlet sel -t -c '*' dl.xml
xmlstarlet sel -t -c '/*' dl.xml
xmlstarlet sel -t -c '//*' dl.xml
As soon as I try to select anything like:
xmlstarlet sel -t -c '//Key' dl.xml
xmlstarlet sel -t -c '/ListBucketResult' dl.xml
No output is given any more. The file given (dl.xml) is plain ASCII.
xmlstarlet reports version 1.6.1-2.1.
Within the original file there are about 50000 Contents-nodes, containing a same number of Key-nodes.
Any idea why it does not work as expected and described? Is this file just to big to be processed by xmlstarlet?
 
    