code: static Node parseInput(InputStream input, String rootTag)
          throws ParsingException
      {
          NodeList nodes = null;
  
          try {
              DocumentBuilderFactory factory =
                  DocumentBuilderFactory.newInstance();
              factory.setIgnoringComments(true);
  
              DocumentBuilder builder = null;
  
              // as of 1.2, we always are namespace aware
              factory.setNamespaceAware(true);
  
              if (ipReference == null) {
                  // we're not validating
                  factory.setValidating(false);
  
                  builder = factory.newDocumentBuilder();
              } else {
                  // we are validating
                  factory.setValidating(true);
  
                  factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
                  factory.setAttribute(JAXP_SCHEMA_SOURCE,
                                       ipReference.schemaFile);
                  
                  builder = factory.newDocumentBuilder();
                  builder.setErrorHandler(ipReference);
              }
  
              Document doc = builder.parse(input);
              nodes = doc.getElementsByTagName(rootTag);
          } catch (Exception e) {
              throw new ParsingException("Error tring to parse " + rootTag +
                                         "Type", e);
          }
  
          if (nodes.getLength() != 1)
              throw new ParsingException("Only one " + rootTag + "Type allowed "
                                         + "at the root of a Context doc");
  
          return nodes.item(0);
      }
docs: Tries to Parse the given output as a Context document.
  
  @param input the stream to parse
  @param rootTage either "Request" or "Response"
  
  @return the root node of the request/response
  
  @throws ParsingException if a problem occurred parsing the document