How to read and write an xml file in Extjs 2.3?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vibhakhushi
    New Member
    • Mar 2010
    • 33

    How to read and write an xml file in Extjs 2.3?

    Hello Everyone,
    Now i am venturing the XmlReader option in Extjs. But I am unable to read an xml file. Please help me by showing the demo.
    Here is my code:
    Code:
    var store = new Ext.data.Store({
            url:'login.xml',        
            autoLoad:true,
            reader: new Ext.data.XmlReader({
                   // record will have an "loginInformation" tag
                   record:'loginInformation',
                   id:'ID'
                   //totalRecords: '@total'
               }, [
                   'USERNAME','PASSWORD'
               ])
        });
        
    	store.load();
    	
    	alert(store.getTotalCount());
    My XML File is:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <loginInformation>
    	<ID>1</ID>
    	<USERNAME>vibha</USERNAME>
    	<PASSWORD>vibha</PASSWORD>
    </loginInformation>
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    did you have a look in Firefox's error console or the Firebug-console? do any errors occur? do you try it from a local machine or via a webserver?

    Comment

    • vibhakhushi
      New Member
      • Mar 2010
      • 33

      #3
      I try from a local machine. I get load exception, as undefined.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        as far as i know the underlying extjs ajax-request (implicitly used with specifying the url-property of the store) will only work for real http-requests and not with the file-protocol ... so you should try it with a webserver ...

        Comment

        Working...