Revision 203
Added by Matt Jones almost 24 years ago
DBValidate.java | ||
---|---|---|
1 | 1 |
/** |
2 |
* Name: DBValidate.java
|
|
3 |
* Purpose: A Class that validates XML documents |
|
4 |
* This class is designed to be 'parser independent |
|
5 |
* i.e. it uses only org.xml.sax classes |
|
6 |
* It is tied to SAX 2.0 methods |
|
7 |
* Copyright: 2000 Regents of the University of California and the |
|
8 |
* National Center for Ecological Analysis and Synthesis |
|
9 |
* Authors: Dan Higgins
|
|
2 |
* '$RCSfile$'
|
|
3 |
* Purpose: A Class that validates XML documents
|
|
4 |
* This class is designed to be 'parser independent
|
|
5 |
* i.e. it uses only org.xml.sax classes
|
|
6 |
* It is tied to SAX 2.0 methods
|
|
7 |
* Copyright: 2000 Regents of the University of California and the
|
|
8 |
* National Center for Ecological Analysis and Synthesis
|
|
9 |
* Authors: Dan Higgins, Matt Jones
|
|
10 | 10 |
* |
11 |
* Version: '$Id$' |
|
11 |
* '$Author$' |
|
12 |
* '$Date$' |
|
13 |
* '$Revision$' |
|
12 | 14 |
*/ |
13 | 15 |
package edu.ucsb.nceas.metacat; |
14 | 16 |
|
... | ... | |
41 | 43 |
*/ |
42 | 44 |
public class DBValidate { |
43 | 45 |
|
44 |
/** Default parser name. */ |
|
45 |
private static final String |
|
46 |
DEFAULT_PARSER = "org.apache.xerces.parsers.SAXParser"; |
|
47 |
|
|
48 | 46 |
static int WARNING = 0; |
49 | 47 |
static int ERROR=1; |
50 | 48 |
static int FATAL_ERROR=2; |
... | ... | |
197 | 195 |
|
198 | 196 |
String doc = args[0]; |
199 | 197 |
|
200 |
DBValidate gxv = new DBValidate(DEFAULT_PARSER); |
|
198 |
MetaCatUtil util = new MetaCatUtil(); |
|
199 |
DBValidate gxv = new DBValidate(util.getOption("saxparser")); |
|
201 | 200 |
if (gxv.validate(doc)) { |
202 | 201 |
System.out.println("XML is valid."); |
203 | 202 |
} else { |
... | ... | |
326 | 325 |
public void setMsg(String s) { msg = s; } |
327 | 326 |
} |
328 | 327 |
} |
328 |
|
|
329 |
/** |
|
330 |
* '$Log$ |
|
331 |
* 'Revision 1.6.2.3 2000/06/25 23:38:16 jones |
|
332 |
* 'Added RCSfile keyword |
|
333 |
* ' |
|
334 |
* 'Revision 1.6.2.2 2000/06/25 23:34:18 jones |
|
335 |
* 'Changed documentation formatting, added log entries at bottom of source files |
|
336 |
* '' |
|
337 |
*/ |
Also available in: Unified diff
Merged in substantial changes to DBWriter and associated classes and to
the MetaCatServlet in order to accomodate the new UPDATE and DELETE
functions. The command line tools and the parameters for the
servlet have changed substantially.