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] Best Practice: id-idref or external entities?

The drawbacks of ID/IDREF include:

* there’s only one set of identifiers per document (you can’t have ISBNs and employee numbers that overlap)

* they have to conform to NCName syntax

* they can’t be composite (“the combination of long and lat must be unique”)

* uniqueness is scoped to a document - you sometimes want smaller scope, sometimes larger scope

* they are very dependent on a validating parser being used (well-formedness doesn’t guarantee ID/IDREF integrity)

* many parsers don’t expose ID-ness in the information delivered to applications

Many of these problems, but not all, are fixed by using key/keyref in XSD.

> An alternative to using id-idref is to use external entities. What is your experience with using external entities? Good experience? Bad experience?

Hate them. If XML parsers provided a decent programmatic interface (“parse this document with &date; set to 2015-10-08”) then they could be quite handy. But having to edit files to change the expansion text is just too clunky by half. It’s much easier to use a processing instruction and expand it in XSLT. And if you need the ability to insert variable content into your document, you also need conditionals and loops.

Llike all macro facilities, some people build empires out of them and thereby create systems that are totally incomprehensible to anyone coming along later.

Used nicely, they can be quite fun. For example, look at this document at the raw text level (e.g. using curl):


It uses entitles to build up a very complex regular expression. But it’s one of very few use cases I would recommend.

I can’t see how they are an alternative to ID/IDREF. How would you represent a hyperlink using entitles?

Michael Kay

[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