Deserialize an XML and display your data in an input

Asked

Viewed 85 times

0

I need to create an upload button that by reading the xml of my invoice can display the key of the Nfe that is inside the tag , inside an input.

I have used several methods and is not drying out.

public void UploadXML(string CHAVE_ACESSO_NFE)
{
    XmlDocument xmldoc = new XmlDocument();
    xmldoc.Load("");
    var chave = xmldoc.SelectSingleNode("cNF").Value;
    if (chave != null)
    {
        chave = CHAVE_ACESSO_NFE;
    }
    else
    {
        chave = "";
    }
}

<div class="col-md-12">
    <div class="col-md-5">
        <div class="flow-btn">
            <label class="control-label">Enviar XML</label>
            <input id="UploadXML" name="UploadXML" data-val="" type="file" value="">
        </div>
    </div>
</div>

$(function () {
    survey("#UploadXML", function () {
        var upload = $("#UploadXML").val();
        var chave = getElementByTagName("<cNF>").val();
        if (upload.length != 'undefined') {
            $.ajax({
                url: '@Url.Action("UploadXML", "SolicitacaoOC")',
                type: 'GET',
                dataType: 'json',
                data: {
                    CHAVE_ACESSO_NFE: chave
                }
            }).done(function (data) {

                if (upload != null) {
                    chave = upload.val();
                } else {
                    chave = "";
                }
            });
        }
    })
});
  • Can you make available what your code has made? and also the layout of xml?

  • The method should be POST on ajax and here you have an answer: https://answall.com/questions/9704/fazer-upload-de-arquivo-com-ajax for that XML https://answall.com/questions/233289/lendo-xml-em-c

  • An example to deserialize: https://answall.com/a/233301/54880

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.