[Laszlo-dev] Anyone know about XML DTD's?
Henry Minsky
henry.minsky at gmail.com
Fri Oct 12 14:48:10 PDT 2007
I took a couple of shortcuts in the interest of not trying to reinvent
the RNG schema
language, in that there is some special case behavior that is
implemented by the compiler and not described by the lfc.lzx file.
For example, in lfc.lzx the <dataset> tag
is declared to just be a subclass of node, and the lfc.lzx file says nothing
about how <dataset> can sometimes contain arbitrary XML. There is
something similar
for the use of HTML content of <text> nodes.
There is tag compiler 'justs knows' that <dataset> sometimes has
literal XML data content. There are just a small number of these
special cases in our syntax, but that is some boilerplate that will
need to go into our
DTD or XSD template. I think almost everything else can be described
by simple one-level 'contains' rules.
On 10/12/07, P T Withington <ptw at pobox.com> wrote:
> containsElements is effectively specifying (restricting) the type of
> `subnodes` attribute of the class. (I don't know if that helps us
> think about it in any better way. I was going to say it is the type
> of the `children` parameter of the constructor, but that is not true
> -- children is a specification of how to build the children of a node
> when you instantiate it, so containsElements is restricting that
> specification, but not in a simple way that I can express as a type
> constraint.)
>
> On 2007-10-12, at 15:41 EDT, Henry Minsky wrote:
>
> > That's certainly possible. Of course our compiler can't deal at all
> > with invalid XML, so you can't get this unless you have a well formed
> > file. But if you have the classes
> > declared, even as just skeletons or interfaces, then this would be
> > the same mechanism as I'm thinking for generating the DTD, e.g.,
> > walking the in-core class model datastructure and serializing it as a
> > DTD.
> >
> > I'm thinking of proposing a syntax for specify tag containment that
> > would extend our class declaration syntax something like this,
> >
> > For example specifying that the <list> tag can contain only <listitem>
> > or subclasses thereof.
> >
> >
> > <class[or interface] name="list">
> > <containsElements restrict="true">
> > <element>listitem</element>
> > </containsElements>
> > ...
> > </class>
> >
> > A basic version of this syntax is used internally in the new
> > schema/lfc.lzx file for declaring the base language and LFC tag
> > nesting rules.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On 10/12/07, David Temkin <temkin at laszlosystems.com> wrote:
> >> It would be incredibly useful to generate a DTD that includes user-
> >> defined classes for a given app on the fly.
> >>
> >> This is really a question for laszlo-user.
> >>
> >> On Oct 12, 2007, at 7:55 AM, Henry Minsky wrote:
> >>
> >>> We're in a position now to generate an XML DTD somewhat more easily
> >>> than
> >>> we used to be, because of recent changes to the compiler. The
> >>> compiler has
> >>> a good in-core representation of the entire class hierarchy, and
> >>> some simple but
> >>> effective rules about tag containment (which classes of tags can be
> >>> children of which other tags).
> >>>
> >>> Does anyone here know enough about DTD's and real world editor tools
> >>> to know what
> >>> would be the most useful and compact format to generate a DTD in?
> >>> The
> >>> one we used to generate was overly huge I think, and since we have a
> >>> better class-oriented representation of the containment rules now, I
> >>> am wondering if there is a small and simple DTD that
> >>> we can generate that would of most use to people who actually use
> >>> them. I personally
> >>> just use emacs NXML mode for editing, so I don't have any first-hand
> >>> knowledge of
> >>> what would be useful to people who actually rely on other
> >>> XML-DTD-aware editors. If anyone has any examples of good DTD
> >>> formats
> >>> for a similar XML-oriented programming language, I'd be
> >>> interested in
> >>> seeing them.
> >>>
> >>>
> >>>
> >>> --
> >>> Henry Minsky
> >>> Software Architect
> >>> hminsky at laszlosystems.com
> >>
> >>
> >
> >
> > --
> > Henry Minsky
> > Software Architect
> > hminsky at laszlosystems.com
>
>
--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
More information about the Laszlo-dev
mailing list