I have an API that generates an XML however whenever I try to get the XML to handle the other side it returns an error.
XML is this:
<ArrayOfResponsaveis xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/webservice.Models">
<Responsaveis>
<id>1</id>
<matricula>uc14100703</matricula>
<nivel>1</nivel>
<nome>danilo dorgam</nome>
<senha>xxxx</senha>
</Responsaveis>
</ArrayOfResponsaveis>
The code I use to read XML is this
public Boolean setLogin(string matricula, string senha)
{
string url = URL_WEBSERVICE+matricula+"/"+senha;
var xdoc = XDocument.Load(@url);
var lv1s = from lv1 in xdoc.Descendants("Responsaveis")
where (string) lv1.Element("id").Value == "1"
select lv1;
return false;
}
but in XDocument.Load
it hangs and shows the following error
System.Xml.XmlException: 'Dados no nível raiz inválidos. Linha 1, posição 1.'