Project

General

Profile

« Previous | Next » 

Revision 443

Added by berkley over 24 years ago

fixed xml tag error in squer

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
386 386
    String xmlquery = ((String[])params.get("query"))[0];
387 387
    String qformat = ((String[])params.get("qformat"))[0];
388 388
    Hashtable doclist = runQuery(xmlquery, user, group);
389
    String resultdoc = createResultDocument(doclist, transformQuery(params));
390

  
389
    String resultdoc = createResultDocument(doclist, transformQuery(xmlquery));
390
	
391
    System.out.println("transformed query");
392
    System.out.println(transformQuery(xmlquery));
391 393
    //format and transform the results                                        
392 394
    if(qformat.equals("html")) {
393 395
      transformResultset(resultdoc, response, out);
......
415 417
    Hashtable doclist = runQuery(xmlquery, user, group);
416 418
    String qformat = ((String[])params.get("qformat"))[0]; 
417 419
    String resultdoc = createResultDocument(doclist, transformQuery(params));
420
    System.out.println(transformQuery(params));
418 421

  
419 422
    //format and transform the results                                        
420 423
    if(qformat.equals("html")) {
......
422 425
    } else if(qformat.equals("xml")) {
423 426
      response.setContentType("text/xml");
424 427
      out.println(resultdoc);
425
    } else {
428
    } else { 
426 429
      out.println("invalid qformat: " + qformat); 
427 430
    }
428 431
  }
......
448 451
  }
449 452
  
450 453
  /**
454
   * removes the <?xml version="1.0"?> tag from the beginning.  This takes a
455
   * string as a param instead of a hashtable.
456
   * 
457
   * @param xmlquery a string representing a query.
458
   */
459
  protected String transformQuery(String xmlquery)
460
  {
461
    xmlquery = xmlquery.trim();
462
    int index = xmlquery.indexOf("?>");
463
    return xmlquery.substring(index + 2, xmlquery.length());
464
  }
465
  
466
  /**
451 467
   * Run the query and return a hashtable of results.
452 468
   *
453 469
   * @param xmlquery the query to run

Also available in: Unified diff