[PD] re: state saving

Frank Barknecht fbar at footils.org
Sat Nov 29 17:32:40 CET 2003


Hallo,
Thomas Grill hat gesagt: // Thomas Grill wrote:

> could one XML expert give me a hand and have a look at the following XML
> structure?
> I have the feeling that the value item using "key" as an attribute isn't
> really well-done, as well as the the way how hierarchies are implemented
> using the "dir" item. Is there a common way to define hierarchies in XML
> land?

I thought about this a bit from the view of not exactly an XML expert,
but maybe an HTML expert. In HTML I would see an analogy to lists.
Lists in html consist of list declarations and list item declarations.
List items may contain lists themselves to build up hierarchies:
 
 <ul>
   <li>First list item</li>
   <li>Second list item
     <ul>
       <li>First nested item</li>
       <li>Second nested item</li>
       <li>Third nested item</li>
     </ul>
   </li>
   <li>Third list item</li>
   <li>Fourth list item</li>
 </ul>

(I also considered definition lists, but they are not good here IMO.)

Using this approach directly in the pool.xml it would look like this:

  <pool>
        <dir key="outer_list">
          <value key="a_symbol">0</value>
          <value key="b_symbol">89</value>
    
        <!-- change here! Not valid with current DTD because of missing key! -->
          <value>   
          <dir key="subfolder">
             <value key="subkey">with a list inside</value>
          </dir>
        <!-- change 2 -->
          </value>
        </dir>
  </pool>
 
I think if following the <li> example it would be much better to
introduce a new attribute-less <de> ("dir entry") or <entry> tag, that
is the only tag possible in a <dir> and in turn may contain <dir> and
<value> items:
 
  <pool>
        <dir key="outer_list">
          <de><value key="a_symbol">0</value></de>
          <de><value key="b_symbol">89</value></de>
    
          <de>   
            <dir key="subfolder">
              <de><value key="subkey">with a list inside</value></de>
            </dir>
          </de>
        </dir>
  </pool>

Specifying the key name as an attribute is fine with me. For
clarification maybe different names for dir-keys and value-keys might
be more readable.

Just my 2 ct.

ciao
-- 
 Frank Barknecht                               _ ______footils.org__




More information about the Pd-list mailing list