3
I know there is a lot of Post on how to read a file XML, but I didn’t find any that present the XML with the same structure I have.
I have the following Code.
private void LeituraXML()
{
    //Criando objeto xml para abrir o arquivo de configuração
    XmlDocument doc = new XmlDocument();
    //Informando o caminho onde esta salvo o arquivo xml
    string cadastro = @"C:\Users\Dell\Documents\Tipo_Documentos.xml";
    doc.Load(cadastro);
    XmlNodeList nodelist = doc.SelectNodes("data");
    foreach (XmlNode node in nodelist)
    {
       string teste1 = node.SelectSingleNode("tipo").InnerText;
       string teste2 = node.SelectSingleNode("metadata").InnerText;
    }
}
and with the XML
<service>
    <name>TiposDocumentaisEMetadados</name>
</service>
<message>
    <type>success</type>
<value/>
</message>
<data>
    <tipo codigo="7" name="Comprovante de Endereço">
      <metadata name="numero_documento" required="false" type="string" max_length="255"/>
      <metadata name="protocolo_processo" required="false" type="string" max_length="255"/>
      <metadata name="assunto" required="false" type="string" max_length="800"/>
      <metadata name="interessado" required="false" type="string" max_length="255"/>
      <metadata name="observacao" required="false" type="string" max_length="255"/>
      <metadata name="data_documento" required="true" type="date_time"/>
      <metadata name="login_autor" required="true" type="string" max_length="50"/>
    </tipo>
</data>
I need to add in variables the code and the name of Tags <tipo> and the tag <metadata> I just need the name?
your xml is just that?
– novic