SiteExperts.com Logo Home | Community | Developer's Paradise | Jobs
User Groups | Site Tools | Site Information | Search

Inside Technique : XML Poetry
By Scott Isaacs

This demonstration uses XML, Data Binding, and Dynamic HTML to create a virtual dynamic poetry application. XML Poetry allows you to drag and drop a "poem" from a set of words and submit it to the server. Your poem is immediately published for viewing on the web.

This application uses 2 XML files, one for defining the word list, and a second file for storing the poems. The list of words is stored in a very simple XML file:

<WORDLIST>
  <WORD>HTML<\WORD>
  <WORD>XML<\WORD>
  ...
<\WORDLIST>

The list of words is downloaded to the XML parser on the client. On the client, Dynamic HTML is used to position each word and to allow the user to drag and drop the words onto the virtual refrigerator. Once you finish writing your poem, you submit it back to the server.

At the server, the poem is inserted into the XML Poetry file. This XML file stores the author and the complete poem in the following format:

<POETS>
  <POET>
    <NAME>Author Name</NAME>
    <WORDS>
      <WORD X="20" Y="20">Words>/WORD>
      ...
    </WORDS>
  </POET>
</POETS>

The name represents the authors name, and the contents of words contains the poem. Each word's X and Y attribute defines the position of the word on the refrigerator.

IE4 required to write and read poems