[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: error in DTD with multiple entities
- From: Marcus Carr <mrc@allette.com.au>
- To: Wendi Sisson <wsisson@east.fedex.com>
- Date: Sun, 12 Aug 2001 14:14:28 +1000
Wendi Sisson wrote:
> I have one DTD that references 2 other DTDs by using entities. The 2
> other DTDs are from 3rd party sources and I am not at liberty to change
> them. Both the referenced DTDs have an element named "country" and so I
> get errors from the parser when I try to parse an XML document that
> uses my DTD.
I would replace the element declaration in each DTD with identically named parameter entities for country.
(Technically, this isn't changing the DTD any more than tidying up line breaks would be - each DTD run by itself
would behave exactly the same way that it currently does.) Then define the contents of the parameter entity in the
internal subset of each document depending on the name of the doctype element.
You would then end up with the same wrapper DTD that you had, and something like this in the first included DTD:
<!ENTITY % Country "<!ELEMENT Country (Foo)>">
and something like this in the second included DTD:
<!ENTITY % Country "<!ELEMENT Country (Bar)>">
Your instances would then either start with:
<!DOCTYPE tx1Root SYSTEM "wrapper.dtd" [
<!ENTITY % Country "<!ELEMENT Country (Foo)>">
%Country;
]>
or with:
<!DOCTYPE tx2Root SYSTEM "wrapper.dtd" [
<!ENTITY % Country "<!ELEMENT Country (Bar)>">
%Country;
]>
Your processor may or may not warn you about the multiple declarations for the Country parameter entity, but it
should process correctly. The only limitation is that if you try to run either DTD in isolation, you will have to
provide the parameter entity and the reference in the internal subset. I think that's the closest you can get to "not
changing the DTDs".
--
Regards,
Marcus Carr email: mrc@allette.com.au
___________________________________________________________________
Allette Systems (Australia) www: http://www.allette.com.au
___________________________________________________________________
"Everything should be made as simple as possible, but not simpler."
- Einstein