An XML language for describing file attributes of a directory tree?

I have an application in mind which will record directory listings of a file system in text form. That is, it should say something like:

File name is: abc.txt Last modification date is: 2009-12-31T01:23 Read-only attribute is: True Hidden attribute is: False

The listings will persist for years in a long-term archive, so the language should be self-evident to an information archaeologist of the future. The language should be able to describe the most commonly-used file attributes of common PC platform file systems: NTFS, FAT, HFS+, ext2/3, etc. It should be able to handle non-Latin file names, different semantics for time stamps on different file systems, etc.

Of course, the obvious choice of a language for structuring this data is some XML-based language. Can anyone point me to a language which already exists for describing hierarchical structures of file attributes and directory attributes, as in a file system? I'm hoping to benefit from the work those language designers did to get the semantics right, create the schema or DTD, work out the niggling details of whether something should be an XML element or attribute, etc.

I've looked in the obvious places: http://xml.coverpages.com, web search engines, the archives of XML-L and comp.text.xml, and here. I didn't find any traces of such languages. The search was complicated a bit because the search term "file attributes" gets lots of hits on the term attributes as used in XML.

Please suggest languages I should investigate. It helps to have the name of the language, and a pointer to a URL where the language and its related tools, syntax definitions, etc. are described.

Thanks in advance!


Tree size is using an XML format to describe directory and file trees.


David A Lee from the XML-Dev list replied:

The xls command in xmlsh does exactly this, but I wouldnt consider it a format designed for long term archival use. It might be useful to you or it might not


Example output

xls -l <dir> <file name="README.txt" path="C:/Work/DEI/xmlsh/trunk/README.txt" length="191" type="file" readable="true" writable="true" executable="true" mtime="2008-11-10T11:18:59"/> <file name="_dist" path="C:/Work/DEI/xmlsh/trunk/_dist" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-11-23T10:38:00"/> <file name="_out" path="C:/Work/DEI/xmlsh/trunk/_out" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-11-23T10:38:04"/> <file name="bin" path="C:/Work/DEI/xmlsh/trunk/bin" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-11-23T10:26:06"/> <file name="build-lib" path="C:/Work/DEI/xmlsh/trunk/build-lib" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-11-01T11:57:19"/> <file name="build.xml" path="C:/Work/DEI/xmlsh/trunk/build.xml" length="3732" type="file" readable="true" writable="true" executable="true" mtime="2009-11-14T12:31:37"/> <file name="doc" path="C:/Work/DEI/xmlsh/trunk/doc" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-11-01T11:56:17"/> <file name="lib" path="C:/Work/DEI/xmlsh/trunk/lib" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-11-20T07:56:56"/> <file name="license.txt" path="C:/Work/DEI/xmlsh/trunk/license.txt" length="1540" type="file" readable="true" writable="true" executable="true" mtime="2009-04-09T09:15:50"/> <file name="notices" path="C:/Work/DEI/xmlsh/trunk/notices" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-11-20T07:49:36"/> <file name="out.txt" path="C:/Work/DEI/xmlsh/trunk/out.txt" length="0" type="file" readable="true" writable="true" executable="true" mtime="2009-11-23T20:44:33"/> <file name="samples" path="C:/Work/DEI/xmlsh/trunk/samples" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-05-27T11:36:54"/> <file name="schemas" path="C:/Work/DEI/xmlsh/trunk/schemas" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2008-05-26T20:36:41"/> <file name="sh_histo" path="C:/Work/DEI/xmlsh/trunk/sh_histo" length="23" type="file" readable="true" writable="true" executable="true" mtime="2009-11-23T11:02:38"/> <file name="src" path="C:/Work/DEI/xmlsh/trunk/src" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-03-20T10:21:07"/> <file name="test" path="C:/Work/DEI/xmlsh/trunk/test" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-10-29T11:14:29"/> <file name="unix" path="C:/Work/DEI/xmlsh/trunk/unix" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-11-16T15:17:48"/> <file name="win32" path="C:/Work/DEI/xmlsh/trunk/win32" length="0" type="dir" readable="true" writable="true" executable="true" mtime="2009-09-20T07:54:55"/> <file name="xmlsh.log" path="C:/Work/DEI/xmlsh/trunk/xmlsh.log" length="116538" type="file" readable="true" writable="true" executable="true" mtime="2009-11-23T20:44:31"/> </dir>


Peter Flynn on the XML-L list kindly pointed me to <strong>Cocoon</strong>. I found the <strong>Directory Generator</strong> in Cocoon: http://cocoon.apache.org/2.1/userdocs/directory-generator.html

It generates XML directory listings according to a DTD they show there, but here's an example:

<dir:directory xmlns:dir="http://apache.org/cocoon/directory/2.0" name="stylesheets" lastModified="1056668768203" date="27.06.03 01:06" size="0" requested="true" sort="name" reverse="false"> <dir:directory name="sites" lastModified="1056668768203" date="27.06.03 01:06" size="0"/> <dir:file name="dynamic-page2html.xsl" lastModified="1056668768203" date="27.06.03 01:06" size="4321"/> <dir:file name="simple-xml2html.xslt" lastModified="1056668768203" date="27.06.03 01:06" size="1234"/> </dir:directory>

There is also an <strong>XPath Directory Generator</strong>: cocoon.apache.org/2.1/userdocs/xpathdirectory-generator.html

Their summary is, "The XPath Directory Generator provides all the functionality of the Directory Generator. Additionaly it is possible to get XML snippets out of the XML files the Directory Generator finds." It generates directory listings like the following example:

<dir:directory xmlns:dir="http://apache.org/cocoon/directory/2.0" name="articles" lastModified="1057183738609" date="03.07.03 00:08" size="0" requested="true" sort="name" reverse="false"> <dir:directory name="images" lastModified="1057183738609" date="03.07.03 00:08" size="0"/> <dir:file name="article1.xml" lastModified="1057183738609" date="03.07.03 00:08" size="123"> <dir:xpath query="/article/title"> <title>My first article!</title> </dir:xpath> </dir:file> <dir:file name="article2.html" lastModified="1057183738609" date="03.07.03 00:08" size="345"/> <dir:file name="article2.xml" lastModified="1057183738609" date="03.07.03 00:08" size="234"> <dir:xpath query="/article/title"> <title>My second article!</title> </dir:xpath> </dir:file> </dir:directory>

What I find interesting about this language is that they put all the file attributes in XML entity attributes, rather than between the tags. I'm very naive on XML language design, so I don't know the pros and cons of each approach. But that's exactly why I hope to piggyback on someone else's language design.


  • What does “A” logging indicator mean in Websphere? [closed]
  • Zend Error controller stopped working for 500
  • How to copy an object by value / clone an object in PHP 5
  • Async checkbox on Google Chrome dev tools missing
  • R shiny and plotly getting legend click events
  • GAE Endpoints error: Expected FooBar Instance, got FooBar()
  • How to disable sparse checkout after enabled?
  • tbb::cache_aligned_allocator: Getting “request for member…which is of non-class type” with __m128i.
  • Replacing XML DataIsland Files in asp.net
  • Lock contention in Java Beanshell interpreter under high load
  • Returning the regular expression match as part of a split (or equivalent functionality)
  • How to get the line number from a Stack Trace?
  • Testing $http.get() requests in angular
  • Is there an existing gem or script that converts numbers to comp-3/packed decimal format?
  • SSRS 2008 - Sorting within a group
  • custom string delimiters stringtemplate-4
  • Insertion large number of Entities into SQL Server 2012 [duplicate]
  • Where these are stored?
  • C: Incompatible pointer type initializing
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • Jackson Parser: ignore deserializing for type mismatch
  • Play WS (2.2.1): post/put large request
  • Master page gives error
  • Deserializing XML into class C#
  • Weird JavaScript statement, what does it mean?
  • Is there a mandatory requirement to switch app.yaml?
  • How to format a variable of double type
  • bootstrap to use multiple ng-app
  • Transpose CSV data with awk (pivot transformation)
  • Matrix multiplication with MKL
  • How to get icons for entities from eclipse?
  • Turn off referential integrity in Derby? is it possible?
  • Append folder name and increment by 1 using batch script
  • JaxB to read class hierarchy
  • Is there any way to bind data to data.frame by some index?
  • Django query for large number of relationships
  • How can i traverse a binary tree from right to left in java?
  • How to Embed XSL into XML
  • Android Heatmap on canvas or ImageView
  • Conditional In-Line CSS for IE and Others?