[xml] Standard dtd?!



hi,

i have a spezial directory for my dtd files.
so my xml-files must look like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE test SYSTEM "<directory>\test.dtd">
<test>
...
</test>

so my problem is, that the directory is depent from different things.

my question is:

how can i specify the dtd-file in my program and not in the xml-file?

i mean,my xml-file should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<test>
...
</test>

or like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE test SYSTEM "test.dtd">
<test>
...
</test>

and than i can set a directory in my program to search for the dtd-file.

thanks
Thomas Rokohl

P.S. at the moment i do this:
..
ctxt=xmlCreateFileParserCtxt(filename);
if (ctxt == NULL) exit(1);
theDtd=xmlParseDTD(NULL,(const xmlChar *)"./dtd/test.dtd");
xmlParseDocument(ctxt);
cvp.userData= (void *)stderr;
cvp.error= (xmlValidityErrorFunc) fprintf;
cvp.warning= (xmlValidityWarningFunc) fprintf;
doc = ctxt->myDoc;
if(!xmlValidateDtd(&cvp,doc,theDtd)){  fprintf(stderr,"Document does not
validate!\n");exit(1);}
if( !ctxt->valid ) {
cout << "failed" << endl << flush;
exit(1);
}
..



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]