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

Re: Best Practice: id-idref or external entities?

  • From: Michael Kay <mike@saxonica.com>
  • To: "Costello, Roger L." <costello@mitre.org>
  • Date: Thu, 8 Oct 2015 15:49:25 +0100

Re:  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):

http://www.w3.org/2011/04/XMLSchema/TypeLibrary-URI-RFC3986.xsd

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
Saxonica




[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.