[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Is recursive markup good? bad? supported? notsupported?

  • From: Liam R E Quin <liam@w3.org>
  • To: "Costello, Roger L." <costello@mitre.org>
  • Date: Sat, 10 Dec 2011 21:39:55 -0500

Re:  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
as
/document/chapter/section/list/item/item-body/list/item
which gave rise to people using list1, list2, section1, section2 and so
on.

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 3.1.2.4 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
drain.

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

-- 
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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.