OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Is recursive markup good? bad? supported? notsupported?

On Sat, 2011-12-10 at 11:53 +0000, Costello, Roger L. wrote:
> Hi Folks,
> There doesn't seem to be a lot of people using recursive markup - I
> received only two examples of schemas containing recursive
> definitions.

I think quite a few people are using XHTML, in which a div can contain
another div; lists are also defined recursively, and so are phrase-level
elements such as em, strong, span, etc.

DocBook also has examples, and so does pretty much any document markup,
as others have noted.

Some older SGML formatters were unable to handle recursion in their
stylesheets, or handled it only with difficulty - e.g. you might have to
specify a style for every possible absolute path in the document, such
which gave rise to people using list1, list2, section1, section2 and so

But the numbered elements made life hard for authors, e.g. in the fairly
common use case of promoting or demoting a passage by a level or two
(take section and make it into its own section, 3.2, please).

An SGML feature called RANK could be used to automate some of this, but
it was not widely supported, and we did not bring it over into XML.
> Why is there such limited use of recursive markup?
I think it's used extraordinarily widely.

>     Recursion in XML Schemas is definitely a bad idea, as it can 
>     cause problems with XML Schema validators/data binding tools.

If you're using XML to represent data structures, it's true that in many
languages a structure can't contain itself. It might be able to contain
a reference to another instance of the same type, but it can' actually
contain another instance or it'd be tortoises all the way down the

So for data binding you have to be careful about recursion.

struct personType {
    String name;
    personType lover;
    colourOrPattern Socks;

doesn't work because there's now a
person.lover.lover.lover.lover.lover.... and that uses a lot of memory.
All of it, in fact.

I tend to think of data binding as a relatively unusual, although
important, use of XML, but that's because I'm a document person
really :-)


Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS