views:

120

answers:

4

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!

+1  A: 

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

Superfilin
A: 

I would post this question on XML-DEV (http://www.xml.org/xml-dev/) and I would be surprised if you didn't get a useful reply. If there isn't a specification for this then there should be and I would expect the OASIS folk to be involved. [You can say I suggested it.]

peter.murray.rust
A: 

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

http://www.xmlsh.org

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>
Jim DeLaHunt
A: 

Peter Flynn on the XML-L list kindly pointed me to Cocoon. I found the Directory Generator 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 XPath Directory Generator: 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.

Jim DeLaHunt