[Home] [By Thread] [By Date] [Recent Entries]

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

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]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member