Making entities available to multiple XML documents

Discussion in 'XML' started by Matthew Burgess, Jul 27, 2003.

  1. I'm not sure that XML allows me to do what I want, but here goes:

    Given that I have files a.xml and b.xml who both need to access an
    entity defined in c.ent how do I go about it?

    Ideally I'd like a syntax similar to:

    --- a.xml (or b.xml) ---
    <!DOCTYPE ... [
    #include c.ent <!-- makes all entities in c.ent available in a.xml
    -->
    ]>

    &c-ent;
    --- end xml file ---

    --- c.ent ---
    <!ENTITY c-ent "entity from c.ent">
    --- end c.ent ---

    Any ideas if/how I can achieve this without putting the entities
    within the DTD itself (which is not an option)?

    Thanks,

    Matt.
    Matthew Burgess, Jul 27, 2003
    #1
    1. Advertising

  2. "Matthew Burgess" <> wrote in message
    news:...
    > I'm not sure that XML allows me to do what I want, but here goes:
    >
    > Given that I have files a.xml and b.xml who both need to access an
    > entity defined in c.ent how do I go about it?
    >
    > Ideally I'd like a syntax similar to:
    >
    > --- a.xml (or b.xml) ---
    > <!DOCTYPE ... [
    > #include c.ent <!-- makes all entities in c.ent available in a.xml
    > -->
    > ]>


    Hmmm. maybe I don't understand your goal or maybe I'm underestimating your
    XML skills, but isn't external DTD (that will contain your entity
    declarations) enough?

    <!DOCTYPE rootname SYSTEM "external.dtd">

    external DTD:

    <!ENTITY name1 "value1">
    <!ENTITY name2 "value2">


    Toni Uusitalo


    >
    > &c-ent;
    > --- end xml file ---
    >
    > --- c.ent ---
    > <!ENTITY c-ent "entity from c.ent">
    > --- end c.ent ---
    >
    > Any ideas if/how I can achieve this without putting the entities
    > within the DTD itself (which is not an option)?
    >
    > Thanks,
    >
    > Matt.
    Toni Uusitalo, Jul 27, 2003
    #2
    1. Advertising

  3. "Toni Uusitalo" <> wrote in message news:<daXUa.2179$>...
    > "Matthew Burgess" <> wrote in message
    > news:...
    > > I'm not sure that XML allows me to do what I want, but here goes:
    > >
    > > Given that I have files a.xml and b.xml who both need to access an
    > > entity defined in c.ent how do I go about it?
    > >
    > > Ideally I'd like a syntax similar to:
    > >
    > > --- a.xml (or b.xml) ---
    > > <!DOCTYPE ... [
    > > #include c.ent <!-- makes all entities in c.ent available in a.xml
    > > -->
    > > ]>

    >
    > Hmmm. maybe I don't understand your goal or maybe I'm underestimating your
    > XML skills, but isn't external DTD (that will contain your entity
    > declarations) enough?
    >
    > <!DOCTYPE rootname SYSTEM "external.dtd">
    >
    > external DTD:
    >
    > <!ENTITY name1 "value1">
    > <!ENTITY name2 "value2">
    >
    >
    > Toni Uusitalo


    I managed to do it this way:

    --- a.xml/b.xml --
    <!DOCTYPE ... [
    <!ENTITY % c-entities SYSTEM "path/to/c.ent">
    %c-entities;
    ]>
    <!-- a.xml/b.xml can now use any entity defined in c.ent -->
    --- end a.xml/b.xml ---

    Thanks,

    Matt.
    Matthew Burgess, Jul 28, 2003
    #3
  4. "Matthew Burgess" <> wrote in message
    news:...

    > I managed to do it this way:
    >
    > --- a.xml/b.xml --
    > <!DOCTYPE ... [
    > <!ENTITY % c-entities SYSTEM "path/to/c.ent">
    > %c-entities;
    > ]>
    > <!-- a.xml/b.xml can now use any entity defined in c.ent -->
    > --- end a.xml/b.xml ---


    Yes, it was parameter entities was what you were after, BTW W3C has
    http://www.w3.org/2003/entities page which contains a lot of entity
    definitions for XML/XHTML.

    Toni Uusitalo
    Toni Uusitalo, Jul 28, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom
    Replies:
    0
    Views:
    429
  2. Peter C. Chapin
    Replies:
    4
    Views:
    1,937
    Peter C. Chapin
    Jul 6, 2003
  3. SV
    Replies:
    1
    Views:
    605
    Mukul Gandhi
    Aug 16, 2005
  4. Tom
    Replies:
    0
    Views:
    565
  5. Jim Higson
    Replies:
    3
    Views:
    210
    Eric Amick
    Jul 25, 2004
Loading...

Share This Page