Originally, there were DTD's in XML, which do something like:
<!ELEMENT efd
(vendor_call,product,model,vendid,price,tech_spec?,phy_spec?,io_spec?,rev_info?,copy,copyright,xinfo)>
<!ELEMENT vendor_call (#PCDATA)>
<!ELEMENT pkill_date (#PCDATA)>
<!ELEMENT copy (text*)>
<!ELEMENT text (sec_title*|section*|sec2_title*|section2*|graphics*)*>
<!ELEMENT sec_title (#PCDATA)>
<!ELEMENT copyright (#PCDATA)>
<!ELEMENT xinfo (x_cad,x_doc,x_efd)>
Where ? means 0 or 1, and * means 0 to infinite.
But DTD's aren't XML, so they came up with schemas,
doing more like:
<empty/>
<choice>
<oneOrMore><empty/><text/><notAllowed/></oneOrMore>
<zeroOrMore><empty/><text/><notAllowed/></zeroOrMore>
<div>
<value datatypeLibrary="XXX">foo</value>
<value>foo</value>
</div>
RelaxNG is kind of a step beyond this, and is the marriage
of Relax and Trex.
The CVS for pyxml has a "sandbox" with a test version of RelaxNG
for Python. More on Trex & Relax_NG are at thaiopensource.org,
stuff for parsing DTD's is in the xmlproc demos from the
PyXML source.
But anyway, the idea of having a few of these
specifiers in a Form specification:
f = self.form = Form.Form()
f1=fieldLibrary.TextField('name',validators=[valAtLeats3Char],
label='name: ')]
f2=fieldLibrary.TextField('address',validators=[valAtLeast3Char],
label='name: ')]
f3=fieldLibrary.TextField('phone',validators=[valAtLeast12Char],
label='name: ')]
block= Form.Block('Address Block',f1,[],
f2,[min=1,max=3,displayAll,labelFirst],
f3,[min=1,max=2,displayAll,labelAll]
)
f.addBlock(block,[label='Main contact',altlabel='Alternate contact',
min=1,max=4,labelFirst,altLabel=2,displayDynamic
)
Thinking about in the future using an input definition file that was
then in schema/relax_ng form to convert to field/block options
would then allow the design on the fly -
<address>
<name type="char" minValue="3">
<address minValue='1' maxValue='2' minNumber='1' maxNumber='2'/>
<phone minValue='12' maxValue='20' minNumber='1' maxNumber='2'/>
</address>
<block><contact label="Main contact" altlabel="Main contact">
<blockitem display="dynamic" minNumber='1' maxNumber='4'
displayNumber="1"><address/></blockitem>
</blockitem>
</block>
where attributes like "minNumber" can be specified in
the schema, and/or overridden by the program and additional
stylesheets (css's and xslt transform sheets).
YEah, it gets pretty huge, but starting small with just
a few options and making it structured for later might
make this easier.
Matt Feifarek wrote:
> This certainly looks promising, but I'm afraid that it's pretty over my
> head.
>
> I'm not familiar with any of the products/projects you mentioned, but we are
> continuously looking for better options for templating than the standard
> ways (isn't everyone?).
>
> We're also looking for more "automatic" ways of defining a form, or defining
> it algorythmically, which also seems to be related to what you've got here.
>
> XML has of course come up several times. I'm quite interested in your
> approach. I'll look into these projects.
>
> To TRY and answer your question, there's no reason that the behavior you're
> talking about couldn't be implemented. We tried very hard to let FormKit's
> black box be pretty transparent. A simple helper/glue function to build your
> template would be easy.
>
> I'll read up and try to understand your ideas. Any tips on where to start?
>
> | -----Original Message-----
> | From: Bill Eldridge [mailto:[EMAIL PROTECTED]]
> | Sent: Thursday, April 18, 2002 7:07 AM
> | To: Matt Feifarek
> | Cc: [EMAIL PROTECTED]
> | Subject: Re: [Webware-discuss] Announce: a new HTML Forms Library for
> | Webware WebKit
> |
> |
> | Matt Feifarek wrote:
> | > Martin and I are making our first public release of our new
> | "FormKit", and
> | > wanted to invite the Webware community to try it out, comment, and even
> | > participate in its further development.
> |
> | [posted only to the devel list]
> |
> | Looks interesting (I'd say fun, but I think that's trademarked
> | by Ian - how about "FreeFormKit"?).
> |
> | One thing I don't really see in either kit is having
> | a template that uses regular expressions, something like:
> |
> | Person:
> | <name>{1}
> | Mandatory 1
> | <address>{1?}
> | Mandatory at least 1
> | <phone>{1,3}
> | Mandatory 1-3
> | <publications>{*} Non-mandatory
> | <email>{1+}
> | <fax>{1?}
> | 0 or 1
> | <company>{1}
> |
> | Company:
> | <companyname>{1}
> | <companycontact>{1+}
> |
> | Contact:
> | ...
> | ...
> |
> | And then have the possibility for FormKit to generate
> | additional blocks as needed, say if I want a second
> | address block for my home office, a third for my
> | PO Box, etc.
> |
> | Something that would parse a schema (Relax NG from
> | PyXML sandbox? regular schemas using PyTrex, also in PyXML)
> | or a DTD would fit in with my XML needs.
> |
> | I can see a bit how to do this on my own, but it seems
> | like dynamic block or field generation would be a useful
> | feature for the FormKit.
> |
> |
> | --
> | Bill Eldridge
> | Radio Free Asia
> | [EMAIL PROTECTED]
> |
--
Bill Eldridge
Radio Free Asia
[EMAIL PROTECTED]
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel