public void read(InputStream in) throws IOException
  {
    try
    {
      XMLInputFactory factory = XMLInputFactory.newInstance();
      XMLStreamReader parser = factory.createXMLStreamReader(in);

      checkNextTag(parser, XMLStreamReader.START_ELEMENT, "matrix");

      m = Integer.parseInt(parser.getAttributeValue(null, "rows"));
      n = Integer.parseInt(parser.getAttributeValue(null, "cols"));

      A = new double[m][n];

      for (int i = 0; i < m; i++)
      {
        checkNextTag(parser, XMLStreamReader.START_ELEMENT, "matrixrow");

        for (int j = 0; j < n; j++)
        {
          checkNextTag(parser, XMLStreamReader.START_ELEMENT, "cn");

          if (!parser.getAttributeValue(null, "type").equals("IEEE-754"))
            throw new IOException("a xml stream exception occured");

          if (parser.next() != XMLStreamReader.CHARACTERS)
            throw new IOException("a xml stream exception occured");

          A[i][j] = getDecodedValue(parser.getText());

          checkNextTag(parser, XMLStreamReader.END_ELEMENT, "cn");
        }

        checkNextTag(parser, XMLStreamReader.END_ELEMENT, "matrixrow");
      }

      checkNextTag(parser, XMLStreamReader.END_ELEMENT, "matrix");
    }
    catch(XMLStreamException xse)
    {
      throw new IOException("a xml stream exception occured");
     }
  }