Menu

[r11]: / branches / dasho / DOM / dtdparse / parse.c  Maximize  Restore  History

Download this file

34 lines (27 with data), 763 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>
#include "y.tab.c"
main(int argc, char* argv[])
{
if (argc == 1)
{
fprintf(stderr, "usage: %s <dtdFile> \n", argv[0]);
exit(1);
}
// redirect stdin to fileName
if ( freopen(argv[1], "r", stdin) == NULL )
{
fprintf(stderr, "cannot open file: %s for reading", argv[1]);
exit(1);
}
// initialize global variables used by dtd parser
xmlDoc = new Document("xml"); // the owner of this DOMImplementation instance
docType = xmlDoc->getDoctype();
elems = docType->getElements();
attribs = docType->getAttributes();
// now parse by calling "yyparse"
// this builds the dtd structure
try { yyparse(); }
catch (DOMException& e)
{ cout << e << endl; exit(1); }
return 0;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.