Hello,

Just an update to anyone following the thread.  I went ahead and
tested the modifications I proposed and if you are interested,
everything seems to work fine.

In case you missed it, the modification I'm talking about is placing
this code between lines 174 and 175 of TaglibHelper:

        elsif($options{'plural_tags'}) {
          my $new_element_name = $lastkey;
          $new_element_name =~ s/s$//;        # Remove trailing 's's
from plural tags
          $item = $document->createElement($new_element_name);
        }

This gives you a new option:

plural_tags

Set this to true to use the preceding hash key as the tag name for
items in arrays.  If the preceding hash key ended with an 's', then
the 's' is stripped off the end.  For example, if you returned the following
data structure:

 {fingers => [{...},{...},{...}]}

Then the resulting XML would be:

  <fingers>
    <finger id="1"> ... </finger>
    <finger id="2"> ... </finger>
    <finger id="3"> ... </finger>
  </fingers>

-Chuck
Scenario Learning
www.safeschools.com

On 10/4/05, Matt Sergeant <[EMAIL PROTECTED]> wrote:
> On 3 Oct 2005, at 17:06, Chuck Phillips wrote:
>
> > Am I oversimplying the modifications needed to add this
> > functionallity?  Is there something that I'm missing?
>
> No, that should work just fine. Not sure if we want to do it though -
> the whole "plural" thing scares me as it puts us in the realms of
> parsing english :-)
>
> I always figured if people want that level of control over the XML
> generated that they'd just use as_xml.
>
> Matt.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to