Project

General

Profile

« Previous | Next » 

Revision 83

Added by Matt Jones about 24 years ago

changed location of catalog file to config parameter

View differences:

GenericXMLValidate.java
32 32
    static int ERROR=1;
33 33
    static int FATAL_ERROR=2;
34 34

  
35
    static String defaultCatalog = "/home/httpd/html/xmltodb/catalog.txt";   
36
    
37 35
    Parser parser;
38 36
    ErrorStorer ef;
39 37
    String xml_doc; // document to be parsed
40 38
    
41
    public GenericXMLValidate( Parser parse)  {
39
    public GenericXMLValidate(Parser parse)  {
42 40
        parser = parse;
43 41
        CatalogEntityResolver cer = new CatalogEntityResolver();
44 42
        try {
45 43
            Catalog myCatalog = new Catalog();
46 44
            myCatalog.loadSystemCatalogs();
47
            myCatalog.parseCatalog(defaultCatalog);
48 45
            cer.setCatalog(myCatalog);
49 46
        }
50 47
        catch (Exception e) {System.out.println("Problem creating Catalog!");}
......
70 67
*/
71 68
    }
72 69
    
70
    public GenericXMLValidate(Parser parse, String xmlcatalogfile)  {
71
        parser = parse;
72
        CatalogEntityResolver cer = new CatalogEntityResolver();
73
        try {
74
            Catalog myCatalog = new Catalog();
75
            myCatalog.loadSystemCatalogs();
76
            myCatalog.parseCatalog(xmlcatalogfile);
77
            cer.setCatalog(myCatalog);
78
        }
79
        catch (Exception e) {System.out.println("Problem creating Catalog!");}
80
        parser.setEntityResolver(cer);
81
    }
82

  
73 83
    public boolean validate(String doc) {
74 84
        xml_doc = doc;    
75 85
        ef = new ErrorStorer();

Also available in: Unified diff