Exemple #1
0
  private void parseResponse(InputStream is) {
    id = null;
    command = null;
    type = UNKNOWN_TYPE;
    errorCode = ERROR_UNKNOWN_TYPE;

    try {
      doc = db.parse(is);
      parent = doc.getFirstChild();
      String nodeName = parent.getNodeName();
      if (nodeName.equals("response")) { // $NON-NLS-1$
        parseResponseType();
      } else if (nodeName.equals("init")) { // $NON-NLS-1$
        parseInitType();
      } else if (nodeName.equals("stream")) { // $NON-NLS-1$
        parseStreamType();
      } else if (nodeName.equals("proxyinit")) { // $NON-NLS-1$
        parseProxyInitType();
      } else if (nodeName.equals("proxyerror")) { // $NON-NLS-1$
        parseProxyErrorType();
      }

    } catch (SAXException e) {
      DBGpLogger.logException(null, this, e);
      type = PARSE_FAILURE;
      errorCode = ERROR_PARSE_FAILURE;
    } catch (IOException e) {
      DBGpLogger.logException(null, this, e);
      type = PARSE_FAILURE;
      errorCode = ERROR_PARSE_FAILURE;
    }
    // System.out.println("wait for me");
  }
Exemple #2
0
 public DBGpResponse() {
   DocumentBuilderFactory dbFact = DocumentBuilderFactory.newInstance();
   try {
     db = dbFact.newDocumentBuilder();
   } catch (ParserConfigurationException e) {
     DBGpLogger.logException(null, this, e);
   }
 }