A
Andy Dingley
How can I best make a composite DTD by including one DTD inside another
?
There's a pre-existing DTD in an external Apache project. I'd like to
make use of this within our internal project, suitably extended and
wrapped. With the aid of an internal and external subset I can do
this, as follows:
<?xml version="1.0"?>
<!DOCTYPE Container
PUBLIC "-//Apache Software Foundation//DTD OJB Repository//EN"
"http://db.apache.org/ojb/repository.dtd"
[
<!-- Wrapper element -->
<!ELEMENT Container (jdbc-connection-descriptor) >
<!ATTLIST jdbc-connection-descriptor displayname CDATA #IMPLIED
]>
<Container>
<jdbc-connection-descriptor
platform="Oracle"
jdbc-level="3.0"
driver="@DRIVER_NAME@"
dbalias="@URL_DBALIAS@"
username="@USER_NAME@"
password="@USER_PASSWD@"
schema="@DB_SCHEMA"
displayname="@DB_NAME"
/>
</Container>
Now obviously I don't want to have to repeat this internal subset into
every one of our documents. I'd like to make a local DTD that
represents this combination of internal and external subsets, as a
single DTD that I can refer to from other documents. Is there any way
to do this?
AFAIK, it's possible to do this, but _only_ if the original DTD was
written with that in mind (DocBook is an example) and it was already
written as modularised components that defined entitites representing
the DTD content and would be expanded in a wrapper DTD. Changing the
wrapper DTD allows you to incorporate the same entities, but manipulate
them however you like. In the simple case though, the DTD is inflexible
except by the rather clumsy way I've done it above.
Is this the best I can do? Should I look at a port to XML Schema
instead?
Apologies for the x-post to c.i.w.a.h, but the traffic there catches
the eyeballs of some people whose opinion I'd respect on this.
?
There's a pre-existing DTD in an external Apache project. I'd like to
make use of this within our internal project, suitably extended and
wrapped. With the aid of an internal and external subset I can do
this, as follows:
<?xml version="1.0"?>
<!DOCTYPE Container
PUBLIC "-//Apache Software Foundation//DTD OJB Repository//EN"
"http://db.apache.org/ojb/repository.dtd"
[
<!-- Wrapper element -->
<!ELEMENT Container (jdbc-connection-descriptor) >
<!ATTLIST jdbc-connection-descriptor displayname CDATA #IMPLIED
]>
<Container>
<jdbc-connection-descriptor
platform="Oracle"
jdbc-level="3.0"
driver="@DRIVER_NAME@"
dbalias="@URL_DBALIAS@"
username="@USER_NAME@"
password="@USER_PASSWD@"
schema="@DB_SCHEMA"
displayname="@DB_NAME"
/>
</Container>
Now obviously I don't want to have to repeat this internal subset into
every one of our documents. I'd like to make a local DTD that
represents this combination of internal and external subsets, as a
single DTD that I can refer to from other documents. Is there any way
to do this?
AFAIK, it's possible to do this, but _only_ if the original DTD was
written with that in mind (DocBook is an example) and it was already
written as modularised components that defined entitites representing
the DTD content and would be expanded in a wrapper DTD. Changing the
wrapper DTD allows you to incorporate the same entities, but manipulate
them however you like. In the simple case though, the DTD is inflexible
except by the rather clumsy way I've done it above.
Is this the best I can do? Should I look at a port to XML Schema
instead?
Apologies for the x-post to c.i.w.a.h, but the traffic there catches
the eyeballs of some people whose opinion I'd respect on this.