code: public static @Nonnull XQuery parse(@WillClose InputSource in) throws IOException {
          try {
              DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
              return new XQuery(db.parse(in));
          } catch (ParserConfigurationException|SAXException ex) {
              throw new IOException("Could not parse XML", ex);
          }
      }
docs: Parses an XML source and returns an {@link XQuery} object representing the root of
  the document.
  
  @param in
  {@link InputSource} of the XML document
  @return {@link XQuery} representing the root of the parsed document
  @throws IOException
  if the XML source could not be read or parsed for any reason