/// <summary> /// Reads the data for XML deserialization (.Net serialization not the official SPARQL results serialization). /// </summary> /// <param name="reader">XML Reader.</param> public void ReadXml(XmlReader reader) { reader.Read(); switch (reader.Name) { case "boolean": _type = SparqlResultsType.Boolean; _result = reader.ReadElementContentAsBoolean(); break; case "variables": _type = SparqlResultsType.VariableBindings; _result = true; reader.Read(); while (reader.Name.Equals("variable")) { _variables.Add(reader.ReadElementContentAsString()); } reader.Read(); if (reader.Name.Equals("results")) { reader.Read(); while (reader.Name.Equals("result")) { _results.Add(reader.DeserializeResult()); } } else { throw new RdfParseException("Unable to deserialize a SparqlResultSet as did not get the expected <results> element after the <variables> element"); } break; default: throw new RdfParseException("Unable to deserialize a SparqlResultSet, expected a <boolean> or <results> element after the <resultSet> element"); } }