cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@localbar.com>
Subject Re: XMLResourceBundle
Date Fri, 23 Jun 2000 10:47:47 GMT

I would like to offer an alternative layout for using XML Resource strings,
which would allow for a DTD.

Using Mike's example;

<?xml version="1.0"?>
  <resources xml:lang="en">
    <forms>
      <form id="contacts-search">
        <labels>
          <label id="searchfor">find:</label>
          <label id="field-to-search">what:</label>
          <label id="from">where:</label>
          <label id="from-mycontacts">my contacts</label>
          <label id="from-allmembers">all members</label>
        </labels>

        <fields>
          <field id="all">all</field>
          <field id="firstname">first name</field>
          <field id="lastname">last name</field>
          <field id="phone">phone</field>
          <field id="email">e-mail</field>
          <submit>Search</submit>
        </fields>
  </forms>
</resources>


and sample usage:
System.out.println(bundle.getString("/resources/forms/form[@id='contacts-search']/labels/label[@id='from-mycontacts']"));

Not nearly as elegant, I most certainly agree.
Advantage. A fixed DTD!!! No changes to the DTD when the resources are updated.




Mime
View raw message