Changeset 2022
- Timestamp:
- 07/10/12 13:25:03 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUClient.java
r2021 r2022 452 452 reader.readEnd(SRU_NS, "terms"); 453 453 handler.onFinishTerms(); 454 455 // scanResponse/echoedScanRequest 456 if (reader.readStart(SRU_NS, "echoedScanRequest", false)) { 457 reader.readEnd(SRU_NS, "echoedScanRequest", true); 458 } 459 460 // scanResponse/diagnostics 461 final List<SRUDiagnostic> diagnostics = 462 parseDiagnostics(reader); 463 if (diagnostics != null) { 464 handler.onDiagnostics(diagnostics); 465 } 466 467 // scanResponse/extraResponseData 468 if (reader.readStart(SRU_NS, "extraResponseData", false)) { 469 reader.consumeWhitespace(); 470 proxy.reset(reader); 471 try { 472 handler.onExtraResponseData(proxy); 473 } catch (XMLStreamException e) { 474 throw new SRUClientException("handler triggered " + 475 "error while parsing 'extraResponseData'", e); 476 } 477 reader.consumeWhitespace(); 478 reader.readEnd(SRU_NS, "extraResponseData", true); 479 } 480 481 reader.readEnd(SRU_NS, "scanResponse"); 482 } 454 } 455 456 // scanResponse/echoedScanRequest 457 if (reader.readStart(SRU_NS, "echoedScanRequest", false)) { 458 reader.readEnd(SRU_NS, "echoedScanRequest", true); 459 } 460 461 // scanResponse/diagnostics 462 final List<SRUDiagnostic> diagnostics = parseDiagnostics(reader); 463 if (diagnostics != null) { 464 handler.onDiagnostics(diagnostics); 465 } 466 467 // scanResponse/extraResponseData 468 if (reader.readStart(SRU_NS, "extraResponseData", false)) { 469 reader.consumeWhitespace(); 470 proxy.reset(reader); 471 try { 472 handler.onExtraResponseData(proxy); 473 } catch (XMLStreamException e) { 474 throw new SRUClientException("handler triggered " 475 + "error while parsing 'extraResponseData'", e); 476 } 477 reader.consumeWhitespace(); 478 reader.readEnd(SRU_NS, "extraResponseData", true); 479 } 480 481 reader.readEnd(SRU_NS, "scanResponse"); 483 482 } catch (XMLStreamException e) { 484 483 throw new SRUClientException(e.getMessage(), e); … … 644 643 reader.readEnd(SRU_NS, "record"); 645 644 } // while 646 647 645 reader.readEnd(SRU_NS, "records"); 648 int nextRecordPosition = reader.readContent(SRU_NS,649 "nextRecordPosition", false, -1); 650 logger.debug("nextRecordPosition = {}", nextRecordPosition);651 handler.onFinishRecords(nextRecordPosition);652 653 // searchRetrieveResponse/echoedSearchRetrieveResponse654 if (reader.readStart(SRU_NS, "echoedSearchRetrieveRequest", false)) { 655 reader.readEnd(SRU_NS, "echoedSearchRetrieveRequest", true);656 }657 658 // searchRetrieveResponse/diagnostics659 final List<SRUDiagnostic> diagnostics = 660 parseDiagnostics(reader);661 if (diagnostics != null) {662 handler.onDiagnostics(diagnostics);663 }664 665 // explainResponse/extraResponseData 666 if (reader.readStart(SRU_NS, "extraResponseData", false)) {667 reader.consumeWhitespace();668 proxy.reset(reader);669 try {670 handler.onExtraResponseData(proxy);671 } catch (XMLStreamException e) {672 throw new SRUClientException("handler triggered " +673 "error while parsing 'extraResponseData'", e);674 }675 reader.consumeWhitespace();676 reader.readEnd(SRU_NS, "extraResponseData", true);677 }678 679 reader.readEnd(SRU_NS, "searchRetrieveResponse"); 680 }646 } 647 648 int nextRecordPosition = reader.readContent(SRU_NS, 649 "nextRecordPosition", false, -1); 650 logger.debug("nextRecordPosition = {}", nextRecordPosition); 651 handler.onFinishRecords(nextRecordPosition); 652 653 // searchRetrieveResponse/echoedSearchRetrieveResponse 654 if (reader.readStart(SRU_NS, "echoedSearchRetrieveRequest", false)) { 655 reader.readEnd(SRU_NS, "echoedSearchRetrieveRequest", true); 656 } 657 658 // searchRetrieveResponse/diagnostics 659 final List<SRUDiagnostic> diagnostics = parseDiagnostics(reader); 660 if (diagnostics != null) { 661 handler.onDiagnostics(diagnostics); 662 } 663 664 // explainResponse/extraResponseData 665 if (reader.readStart(SRU_NS, "extraResponseData", false)) { 666 reader.consumeWhitespace(); 667 proxy.reset(reader); 668 try { 669 handler.onExtraResponseData(proxy); 670 } catch (XMLStreamException e) { 671 throw new SRUClientException("handler triggered " 672 + "error while parsing 'extraResponseData'", e); 673 } 674 reader.consumeWhitespace(); 675 reader.readEnd(SRU_NS, "extraResponseData", true); 676 } 677 678 reader.readEnd(SRU_NS, "searchRetrieveResponse"); 681 679 } catch (XMLStreamException e) { 682 680 throw new SRUClientException(e.getMessage(), e); … … 703 701 SRUXMLStreamReader reader) throws XMLStreamException, 704 702 SRUClientException { 703 logger.debug("XXX: try diagnostics: {}", reader.dumpState()); 705 704 if (reader.readStart(SRU_NS, "diagnostics", false)) { 706 705 List<SRUDiagnostic> diagnostics = null; … … 725 724 boolean required) throws XMLStreamException, SRUClientException { 726 725 if (reader.readStart(SRU_DIAGNOSIC_NS, "diagnostic", required)) { 726 727 727 // diagnostic/uri 728 728 String uri = reader.readContent(SRU_DIAGNOSIC_NS, "uri", true);
Note: See TracChangeset
for help on using the changeset viewer.