code: public static XElement parseXML(ResultSet rs, int index) 
              throws SQLException, IOException, XMLStreamException {
          try (InputStream is = rs.getBinaryStream(index)) {
              if (is != null) {
                  return parseXML(is);
              }
              return null;
          }
      }
docs: Reads the contents of a indexed column as an XML.
  @param rs the result set to read from
  @param index the column index
  @return the parsed XNElement or null if the column contained null
  @throws SQLException on SQL error
  @throws IOException on IO error
  @throws XMLStreamException on parsing error