473,382 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Assembling composite DTDs

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) >

<!-- Remove the attribute we don't want -->
<!ATTLIST jdbc-connection-descriptor jcd-alias CDATA #IMPLIED

<!-- Add a couple of attributes we do want -->
<!ATTLIST jdbc-connection-descriptor schema CDATA #IMPLIED <!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.

Jun 2 '06 #1
4 1382
Andy Dingley <di*****@codesmiths.com> wrote:
AFAIK, it's possible to do this, but _only_ if the original DTD was
written with that in mind


I believe that's correct.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 2 '06 #2
Andy Dingley wrote:
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) >

<!-- Remove the attribute we don't want -->
<!ATTLIST jdbc-connection-descriptor jcd-alias CDATA #IMPLIED

<!-- Add a couple of attributes we do want -->
<!ATTLIST jdbc-connection-descriptor schema CDATA #IMPLIED

<!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?


Create a file, e.g. my.dtd with (untested code warnings!!)

<!-- this will include the repository.dtd -->
<!ENTITY % repository.dtd
PUBLIC "-//Apache Software Foundation//DTD OJB Repository//EN"
"http://db.apache.org/ojb/repository.dtd">
repository.dtd;

<!-- add your own declarations here -->
<!-- Wrapper element -->
[...snip...]
and use it as in
<!DOCTYPE Container SYSTEM "path/to/my.dtd">

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.


If the DTD is designed for customizations, you could declare parameter
entities before including the DTD to adjust some things to you own needs.
If the DTD is not designed for customizations, you can still add attributes,
entities, etc. but the possibilities are rather limited.
--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/
Jun 2 '06 #3
Andy Dingley <di*****@codesmiths.com> wrote:
How can I best make a composite DTD by including one DTD inside another
?


See the FAQ on exactly this: http://xml.silmaril.ie/developers/dtdincludes/
///Peter
--
XML FAQ: http://xml.silmaril.ie/
Jun 2 '06 #4
In article <11**********************@g10g2000cwb.googlegroups .com>,
"Andy Dingley <di*****@codesmiths.com>" <di*****@codesmiths.com>
wrote:
Should I look at a port to XML Schema instead?


If you decide to abandon DTDs, RELAX NG is likely to be a better choice
than W3C XML Schema. And the Compact Syntax is even human-writable.

See:
http://www.imc.org/ietf-xml-use/mail.../msg00217.html
http://lists.xml.org/archives/xml-de.../msg00057.html

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Validation Service for RELAX NG: http://hsivonen.iki.fi/validator/
Jun 3 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ken | last post by:
Our tool control applicatioin is currently comprised of a .NET part written in C#, components written in C++ and a Lab View component. They are at different version levels. Not all composite...
0
by: Michael Andersson | last post by:
Given a set of classes class A { enum [ ID = 0x0001} }; class B { enum [ ID = 0x0002} }; class B { enum [ ID = 0x0004} }; I wish to generate a composite class, perhaps using something like...
0
by: AshifToday | last post by:
this was my and my frineds little project in earlier classes, the program seperates the composite and prime numbers in two sections of the screen ===================== /* This program has...
18
by: Thomas A. Anderson | last post by:
I am a bit confused in creating a composite primary key. I have three table with two of the tables containing primary keys. I have two of the tables (each with a primary key) having one to many...
4
by: Ismail Rajput | last post by:
Is there any option we can use Composite DataKeyField in the DataList and DataGrid?
9
by: wardy1975 | last post by:
Hi All, Looking for a little expert advice on a few web standards issues. I am currently trying to understand the impact of web standards for a web application I work with. I have been doing a...
4
by: Mark Olbert | last post by:
This involves a family of related, databound ASPNET2 composite controls. I've managed to arrange things so that the composite controls restore themselves from ViewState on postback after they're...
5
by: Andy Dingley | last post by:
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,...
14
by: dave.dolan | last post by:
Basically I'd like to implement the composite design pattern with leaves that are either of reference or value types, but even using generics I can't seem to avoid boxing (using ArrayList or...
3
by: Eric | last post by:
I have created a fairly basic composite control consisting of a Label and a TextBox. In the overridden Render function, I'm creating a table with two rows and each row contains a cell (td). The...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.