Hi guys,

I'm (re)reading the custom FieldHandler tutorial
(http://www.castor.org/xml-fieldhandlers.html) and tracing through the
code, starting from Mapping.loadMapping(), to figure out how and by what
class/method the FieldHandler gets set up, and hence where to start in
adding a format attribute to <field>.

Can you suggest any other good starting points?  Also, is there anything
like http://castor.org/design-persist.html but about how the mapping stuff
is implemented?  I.e. something that would explain the flow and process by
which the mapping file is converted into a tree of ClassDescriptors,
FieldDescriptors, FieldHandlers, etc?

The package docs for Mapping are a good start:

http://castor.org/api/org/exolab/castor/mapping/package-summary.html

But I can't seem to find something similar for mapping/xml.

Once I have a clear idea of how to approach it, I'll open a JIRA issue
with the proposal.

On the attribute-vs-subelement question:

Adding a simple, single string attribute seems straight-forward enough and
non-controversial.  The attribute can contain a formatting string
in whatever formatting syntax the FieldHandler can handle.  This will be my
default approach, something like:

        <field name="total" type="string" node="text"
handler="FormattingHandler" format="%9.2">
            <bind-xml name="total"/>
        </field>


I do want to think about how hard it might be to use an approach that
supports arbitrary XML tags. I'm not going to try too hard at it
(particularly because the rest of you seem rather skeptical at best about
this approach :-), but I figure it's worth taking a few minutes to
consider it.  Maybe in a <format></format> tag set inside
<field>, like so:

        <field name="total" type="string" node="text"
handler="FormattingHandler">
            <bind-xml name="total"/>
            <format>
                 <type>numeric</type>
                 <count>9</count>
                 <decimals>2</decimals>
            </format>
        </field>

The idea would be that everything inside the <format></format> tags is
entirely up to the FieldHandler implementer.  The reason I like this
approach is because it would give developers a lot more
freedom/flexibility in designing their formatter.  Having to drop
out of XML and use a printf() style formatting language seems kind of
ironic.  They could even embed an XSLT script to be invoked for
formatting.

Steven J. Owens
[EMAIL PROTECTED]



-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to