preprocessor for DTDs?

N

nobody

hello!

do you know of any (free) preprocessor able to deal with
DTDs?

I'dlike to do things as
#define with_b
...
<!ELEMENT a (#PCDATA)>
<!ELEMENT c (#PCDATA)>
#ifdef with_b
<!ELEMENT b (#PCDATA)>
#endif
...
#ifdef with_b
<!ELEMENT x (a+,
#ifdef with_b
b*,
#endif
c)>
...
like with the good old C preproc.
I'm aware of the INCLUDE/IGNORE "feature" but I'm missing
dynamic evaluation of this statements.

thx for any hints, andreas (ala_NO@SPAM_context.ch)
 
S

Stefan Ram

nobody said:
do you know of any (free) preprocessor able to deal with
DTDs?

Two good preprocessors:

http://math.polytechnique.fr/cmat/auroux/prog/gpp.html
http://www.ross.net/funnelweb/
I'dlike to do things as
#define with_b
...
<!ELEMENT a (#PCDATA)>
<!ELEMENT c (#PCDATA)>
#ifdef with_b
<!ELEMENT b (#PCDATA)>
#endif
...
#ifdef with_b
<!ELEMENT x (a+,
#ifdef with_b
b*,
#endif
c)>

I would use any language, or even better: Perl, i.e.:

use strict;
use warnings;

sub with_b
{ return "
<!ELEMENT a (#PCDATA)>
<!ELEMENT c (#PCDATA)>
"; }

if( defined with_b )
{ print "
<!ELEMENT b (#PCDATA)>
"; }

This (perl) is even better than any pre-processor - you could
easily query a database or a remote web page, if you want to
make you DTD depending on its contents or arbitrarily complex
functions of both. There are even CPAN modules to help you
to parse DTDs, so you could also analyze another DTD with
that "preprocessor" and then generate your DTD depending on
this.
 
A

Alain Ketterlin

nobody said:
do you know of any (free) preprocessor able to deal with
DTDs?

I'dlike to do things as
#define with_b
...
<!ELEMENT a (#PCDATA)>
<!ELEMENT c (#PCDATA)>
#ifdef with_b
<!ELEMENT b (#PCDATA)>
#endif
...
#ifdef with_b
<!ELEMENT x (a+,
#ifdef with_b
b*,
#endif
c)>
...
like with the good old C preproc.

Why not use... the good old preproc. It's called cpp on my system.

-- Alain.
 
N

nobody

Alain said:
Why not use... the good old preproc. It's called cpp on my system.
C preprocessors expect C syntax, at least those I tried out
couldn't preproc non C sources ;-(
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top