Project

General

Profile

« Previous | Next » 

Revision 5338

Added by berkley over 14 years ago

fixed schema location bug. the dataone schemas are now correclty found

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
3393 3393
            // Get an instance of the parser
3394 3394
            String parserName = PropertyService.getProperty("xml.saxparser");
3395 3395
            parser = XMLReaderFactory.createXMLReader(parserName);
3396
            XMLSchemaService.populateRegisteredSchemaList();
3396 3397
            if (ruleBase != null && ruleBase.equals(EML200)) {
3397 3398
                logMetacat.info("DocumentImpl.initalizeParser - Using eml 2.0.0 parser");
3398 3399
                chandler = new Eml200SAXHandler(dbconn, action, docid, rev,
......
3457 3458

  
3458 3459
                if (ruleBase != null && ruleBase.equals(SCHEMA)
3459 3460
                        && needValidation) {
3461
                
3462
                    XMLSchemaService xmlss = XMLSchemaService.getInstance();
3463
                    xmlss.doRefresh();
3460 3464
                    logMetacat.info("DocumentImpl.initalizeParser - Using General schema parser");
3461 3465
                    // turn on schema validation feature
3462 3466
                    parser.setFeature(VALIDATIONFEATURE, true);
......
3464 3468
                    //parser.setFeature(NAMESPACEPREFIXESFEATURE, true);
3465 3469
                    parser.setFeature(SCHEMAVALIDATIONFEATURE, true);
3466 3470
                    
3467
                    Vector<XMLSchema> schemaList = XMLSchemaService.findSchemasInXML((StringReader)xml);
3471
                    Vector<XMLSchema> schemaList = xmlss.findSchemasInXML((StringReader)xml);
3472
                    System.out.println("schemaList: " + schemaList.toString());
3468 3473
                    boolean allSchemasRegistered = 
3469
                    	XMLSchemaService.areAllSchemasRegistered(schemaList);
3474
                    	xmlss.areAllSchemasRegistered(schemaList);
3470 3475
                    System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!are all schemas registered: " + allSchemasRegistered);
3471
                    if (XMLSchemaService.useFullSchemaValidation() && !allSchemasRegistered) {
3476
                    if (xmlss.useFullSchemaValidation() && !allSchemasRegistered) {
3472 3477
                        System.out.println("setting full schema validation");
3473 3478
                    	parser.setFeature(FULLSCHEMAVALIDATIONFEATURE, true);
3474 3479
                    }
3475 3480
                    // From DB to find the register external schema location
3476 3481
                    String externalSchemaLocation = null;
3477
                    externalSchemaLocation = XMLSchemaService.getNameSpaceAndLocationString();
3482
                    externalSchemaLocation = xmlss.getNameSpaceAndLocationString();
3478 3483
                    System.out.println("external schema location: " + externalSchemaLocation);
3479 3484
                    logMetacat.debug("DocumentImpl.initalizeParser - Generic external schema location: " + externalSchemaLocation);              
3480 3485
                    // Set external schemalocation.
src/edu/ucsb/nceas/metacat/service/XMLSchemaService.java
191 191
		// get the system id from the xml_catalog table for all schemas.
192 192
		String sql = "SELECT public_id, system_id FROM xml_catalog where "
193 193
				+ "entry_type ='" + DocumentImpl.SCHEMA + "'";
194
        System.out.println("!!!!!!!!!!!!!!!!!!!!sql: " + sql);
194 195
		try {
195 196
			// check out DBConnection
196 197
			conn = DBConnectionPool

Also available in: Unified diff