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

Best Practice: id-idref or external entities?

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Thu, 8 Oct 2015 12:06:29 +0000

Best Practice: id-idref or external entities?
Hi Folks,

What is your experience with using id-idref? Good experience? Bad experience? It seems to me that the id-idref pair has a lot of resemblances to GOTOs, which implies that it might be wise to avoid id-idref.

An alternative to using id-idref is to use external entities. What is your experience with using external entities? Good experience? Bad experience? It seems to me that external entities have a lot of resemblances to macro expansion, which is used with good effect in assembly programming, which implies that it might be good to use external entities.

Below are two examples: the first uses id-idref and the second uses external entities. Which approach do you prefer? Or perhaps there is another approach that you prefer?  /Roger

----------------------------------------------
                 id-idref
----------------------------------------------
<Books>
    <Book>
        <Author idref="RB" />
        <Title>Illusions: The Adventures of a Reluctant Messiah</Title>
    </Book>
    <Book>
        <Author idref="RF" />
        <Title>All I Really Need to Know I Learned in Kindergarten</Title>
    </Book>
    <Book>
        <Author idref="RB" />
        <Title>Jonathan Livingston Seagull</Title>
    </Book>
    <Authors>
        <Author id="RB">Richard Bach</Author>
        <Author id="RF">Fulghrum</Author>
    </Authors>
</Books>

----------------------------------------------
               external entities
----------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Books [
   <!ENTITY RichardBach SYSTEM "RichardBach.xml">
   <!ENTITY RobertFulghrum SYSTEM "RobertFulghrum.xml">
]>
<?xml-stylesheet type="text/xsl" href="identity.xsl"?>
<Books>
    <Book>
        &RichardBach;
        <Title>Illusions: The Adventures of a Reluctant Messiah</Title>
    </Book>
    <Book>
        &RobertFulghrum;
        <Title>All I Really Need to Know I Learned in Kindergarten</Title>
    </Book>
    <Book>
        &RichardBach;
        <Title>Jonathan Livingston Seagull</Title>
    </Book>
</Books>

----------------------------------------------
            RichardBach.xml
----------------------------------------------
<Author>
    <Name>Richard Bach</Name>
</Author>

----------------------------------------------
            RobertFulghrum.xml
----------------------------------------------
<Author>
    <Name>Robert Fulghrum</Name>
</Author>


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