Thursday, 25 August 2011

JQuery read XML file tag attributes


var XmlFileNameWithPath = '';
var SearchPatern = '';   

$.ajax({
    type: "GET",
    url: XmlFileNameWithPath,
    dataType: "xml",
    async:false,
    success: function(xml)
    {
        try
        {        
            SearchPatern = 'EleTag';    //Element tag name
           
            $(xml).find(SearchPatern).each(function()
            {
                Name = $ (this).attr("name");   //Element attribute name
            });
        }
        catch(err){}   
    },
    error:function()
    {          
    },
    cache: false
});

1 comment:

  1. Oh, what an amazing solution, I seriously dont think that we can solve this complicated problem so easy, its just some fantastic! I am not big expert in such sphere, but maybe this site with good explanation about how to open .xml file https://wikiext.com/xml will be helpful for u too.

    ReplyDelete