Farrukh Najmi wrote:
> 
> 
> No one has responded to my question below in many days so I will repeat
> it in simpler terms in the hope that someone will take the time to respond.
> 
> Does ATOM support hierarchical entries in a feed where an entry has
> another entry nested inside it?

Not directly.  One way of accomplishing this would be to nest the entry
within the atom:content element, e.g.

<entry xmlns="http://www.w3.org/2005/Atom";>
  ...
  <content type="application/atom+xml;type=entry">
    <entry>
      ...
      <content type="application/atom+xml;type="entry">
        <entry>
          ...
        </entry>
      </content>
    </entry>
  </content>
</entry>

That, however, can become quite unwieldly in practice.  Another approach
would be to have each entry as a separate file and use the src attribute.

<!-- entryA.atom -->
<entry xmlns="http://www.w3.org/2005/Atom";>
  ...
  <content type="application/atom+xml;type=entry"
           src="entryB.atom" />
</entry>

<!-- entryB.atom -->
<entry xmlns="http://www.w3.org/2005/Atom";>
  ...
  <content type="application/atom+xml;type=entry"
           src="entryC.atom" />
</entry>

<!-- entryC.atom -->
<entry xmlns="http://www.w3.org/2005/Atom";>
  ...
</entry>

This has the upside of being easier to handle but requires additional
roundtrips.

- James

> If not, what is the suggested way to handle that use case? The classic
> example is an atom feed for a directory tree where each entry is a node
> in the tree. How would one go about representing that in ATOM?
> 
> Farrukh Najmi wrote:
>>
>> Hello,
>>
>> I am new to ATOM and have a followup question to the archived message
>> below.
>>
>> Since a folder can contain other folders thus defining a item
>> hierarchy how is this hierarchical content best represented in an ATOM
>> feed? A modified example based on original from archived message below
>> would be terrific. Thanks.
>>
>> <archived message>
>>
>> One important thing to keep in mind is that the author element is only
>> required in an entry if it does not exist at the feed level, so you
>> really do not need to worry about entry level authors.
>>
>> This is just off the top of my head, so this might not entirely work,
>> but if I were building an Atom feed from a directory listing, I'd likely
>> do something like the following:
>>
>> <feed xmlns="...">
>>  <id>file:/path/to/the/folder</id> <!-- or whatever else works -->
>>  <title>folder name</title>
>>  <updated>{folder last modified timestamp}</updated>
>>  <link rel="self" href="..." />
>>  <link rel="alternate" href="..." />
>>  <author><name /></author> <!-- the name can be empty-->
>>
>>  <entry>
>>    <id>file:/path/to/the/file</id>
>>    <title>filename</title>
>>    <updated>{file last modified timestamp}</updated>
>>    <link rel="alternate" type="..." href="file:/path/to/the/file" />
>>    <summary>filename, type, last modified, size, etc. Info that would
>>      typically appear in a directory listing</summary>
>>  </entry>
>>
>> </feed>
>>
>> It really shouldn't need to get anymore complicated than that.
>>
>> - James
>>
>> </archived message>
>>
> 
> 

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to