I have a headache in my project here ...
I have to consume data from a webservice that sends them in xml format. Currently, I can get this xml from webservice , but I can not scan all the xml and mount my grid according to all tags which has in xml .
What happens is that xml has the root and several sub-elements that are not read. The xml layout is this:
<?xml version="1.0" encoding="UTF-8" ?>
<certidoes>
<codigo_retorno>99999</codigo_retorno>
<mensagem_retorno> </mensagem_retorno>
<qtd_registros>0</qtd_registros>
<certidao>
<codigo_hash />
<metodo />
<numero_solicitante />
<numero_recebedor />
<tipo_registro />
<data_solicitacao />
<nome_registrado_1 />
<nome_registrado_2 />
<novo_nome_registrado_1 />
<novo_nome_registrado_2 />
<data_ocorrido />
<data_registro />
<matricula />
<obs_solicitacao />
<emolumentos>0</emolumentos>
</certidao>
</certidoes>
What happens is that when creating the Grid with these tags, the Grid is created only with the first three tags, that is: <codigo_retorno>
, <mensagem_retorno>
and <qtd_registro>
... And the others are missing information ...
Is there any way I can do this Grid with all XML tags?
And how could I do that if the <qtd_registros>
tag has value equal to 0, I do not show, say, ignore, and not show on the Grid? That is, show data that has value greater than 0.
The code I use to do this reading, I took the macoratti tutorial , where you have a button that has the following codes?
DataSet ds = new DataSet();
ds.ReadXml(@"C:\caminho\do\arquivol");
dgvXML.DataSource = ds.Tables[0].DefaultView;
And in my scenario I use the following form because the return of xml is dynamic:
DataSet tabela = new DataSet();
MemoryStream ms = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(temp));
tabela.ReadXml(ms);
How can I do this?