[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-j-dev
Subject:    Re: XInclude and general entities
From:       Murray Altheim <m.altheim () open ! ac ! uk>
Date:       2004-09-08 19:56:19
Message-ID: 413F63E3.9040403 () open ! ac ! uk
[Download RAW message or body]

Konrad Rokicki wrote:
> Hi,
> I don't know if this is even possible, but:
> I have an read-only XML file (report.xml) with a DTD that just defines
> some entities. I want to add some entities to this DTD but I can't
> change the file.. the solution I'm trying at the moment is to build
> another file with my own DTD, then XInclude the original file. I
> thought it might merge the DTD's but it doesn't seem to work. Is there
> any way to accomplish this, or does anyone have an alternative
> solution?
> Thanks,
> Konrad

Konrad,

Here's my interpretation of your problem and a possible solution:

  Original file (report.xml):

    <!DOCTYPE report SYSTEM "report.dtd">
    <report>
        <data>Here's some &euml;bermensch data.</data>
    </report>

  Original DTD (report.dtd):

    <!-- begin Report DTD -->
    <!ELEMENT report ( data* )>
    <!ELEMENT data ( #PCDATA )*>
    <!ENTITY euml "&#235;">
    <!-- end DTD -->

and you want to modify the available declarations in the DTD
without modifying either file. Change the name of "report.dtd"
to something else, say "report_orig.dtd". Then create a new
DTD file like this:

  New version of report.dtd:

    <!-- begin New Report DTD -->
    <!ELEMENT % report_orig SYSTEM "report_orig.dtd">
    %report_orig;
    <!ENTITY eacute "&#233;">
    <!ENTITY ecirc  "&#234;">
    <!-- end DTD -->

In this way, report.xml calls your new DTD, which in turn calls
the original.

If you want to redefine anything in the original DTD, you
pre-declare any of its contents prior to instantiating it.
Other than that, anything declared after its instantiation
is appended to the list of declarations.

Hope this helps,

Murray

......................................................................
Murray Altheim                    http://kmi.open.ac.uk/people/murray/
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK               .

   The Pentagon announced that the US death toll had reached 1,001 -
   three of them civilian contractors - since US-led forces moved in
   to Iraq to topple Saddam Hussein 18 months ago. The number of
   wounded had reached 7,000. The White House paid tribute to those
   who had lost their lives. "We remember, honour and mourn the loss
   of all those that made the ultimate sacrifice defending freedom,"
   said US presidential spokesman Scott McClellan.

   He added that the best way to honour them was to continue waging the
   war on terror making "the world a safer place and make America more
   secure". -- http://news.bbc.co.uk/1/hi/world/middle_east/3636340.stm

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic