XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
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]
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]


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