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 ([email protected]_context.ch)
 
Ad

Advertisements

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.
 
Ad

Advertisements

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 ;-(
 

Top