1. #1
    Sencha User sagar.uplenchwar's Avatar
    Join Date
    May 2011
    Location
    Texas
    Posts
    6
    Vote Rating
    0
    sagar.uplenchwar is on a distinguished road

      0  

    Default Reading complex XML using XMLReader.

    Reading complex XML using XMLReader.


    Hello All,
    I am new to sencha touch. I know how to read simple XML .I want to read complex XML response in my application.The XML looks like below.

    <LicenseKey licensedTo="Sagar">
    <DefaultProductType>
    <ProductType name="SINGLE" code="INV"/>
    <ProductType name="COUPLE" code="INV"/>
    <ProductType name="GROUP" code="GRP"/>
    <ProductType name="VOLUNTARY" code="VOL"/>
    </DefaultProductType>

    <Products>

    <Product name="Sagar1" code="Bedford">
    <States>
    <State name="Arizona" code="AZ"/>
    <State name="California" code="CA"/>
    <State name="Colorado" code="CO"/>
    <State name="Connecticut" code="CT"/>
    <State name="Florida" code="FL"/>
    <State name="Hawaii" code="HI"/>
    <State name="Illinois" code="IL"/>
    <State name="Indiana" code="IN"/>
    <State name="Maryland" code="MD"/>
    <State name="Massachusetts" code="MA"/>
    <State name="Michigan" code="MI"/>
    <State name="Nevada" code="NV"/>
    <State name="New Hampshire" code="NH"/>
    <State name="New Jersey" code="NJ"/>
    <State name="New York" code="NY">
    <excludedProductType>
    <excludedProductType name="Group" code="GRP"/>
    <excludedProductType name="Voluntary" code="VOL"/>
    </excludedProductType>
    </State>
    <State name="Ohio" code="OH"/>
    <State name="Virginia" code="VA"/>
    </States>
    </Product>

    <Product name="Sagar2" code="Arlington">
    <States>
    <State name="Arizona" code="AZ"/>
    <State name="California" code="CA"/>
    <State name="Colorado" code="CO"/>
    <State name="Connecticut" code="CT"/>
    <State name="Florida" code="FL"/>
    <State name="Hawaii" code="HI"/>
    <State name="Illinois" code="IL"/>
    <State name="Indiana" code="IN"/>
    <State name="Maryland" code="MD"/>
    <State name="Massachusetts" code="MA"/>
    <State name="Michigan" code="MI"/>
    <State name="Nevada" code="NV"/>
    <State name="New Hampshire" code="NH"/>
    <State name="New Jersey" code="NJ"/>
    <State name="Ohio" code="OH"/>
    <State name="Virginia" code="VA"/>
    </States>
    </Product>
    </Products>
    </LicenseKey>



    Can anyone guide me with this problem?


    Thanks!

  2. #2
    Sencha User sagar.uplenchwar's Avatar
    Join Date
    May 2011
    Location
    Texas
    Posts
    6
    Vote Rating
    0
    sagar.uplenchwar is on a distinguished road

      0  

    Default


    Here is model which I wrote for my XML. I am not able to verify wheather my code is reading XML or not?

    Code:
    <!DOCTYPE HTML>
    <html>
    <head>
    <title>Touch Test</title>
    
    
    
    
    
    <script type="text/javascript">
    Ext.setup({
        
        glossOnIcon: false,
        onReady: function() {
    
            
            
        Ext.regModel('LicenseKey', {
                fields: [ 'licensedTo'],
                
        //    associations:[
        //    {type:'hasMany',model:'DefaultQuoteTypes',name:'DefaultQuoteType'},
        //    {type:'hasMany',model:'Products',name:'Product'}
        //    ]
            validations:[
            {type: 'presence',  field: 'licensedTo'},
            ]
            });
            
            
        Ext.regModel('DefaultQuoteTypes', {
                fields: [],
            hasMany:{model:'QuoteType',name:'QuoteTypes'},
            belongTo:{model:'LicenseKey',name:'LicenseKeys'}
            });    
        
        Ext.regModel('QuoteType', {
                fields: ['name','code'],
            belongTo:{model:'DefaultQuoteTypes',name:'DefaultQuoteType'}
            });    
            
        Ext.regModel('Products', {
                fields: [],
            hasMany:{model:'Product1',name:'Product1s'},
            belongTo:{model:'LicenseKey',name:'LicenseKeys'}
        });
        Ext.regModel('Product1', {
                fields: ['name','code'],
            //hasMany:{model:'States',name:'States'},
            belongTo:{model:'Products',name:'Product'}
        });
        Ext.regModel('States', {
                fields: [],
            hasMany:{model:'State',name:'State'},
            belongTo:{model:'Product1',name:'Product1s'}
        });
        Ext.regModel('State', {
                fields: ['name','code'],
            //hasMany:{model:'excludedQuoteType',name:'excludedQuoteTypes'},
            belongTo:{model:'States',name:'States'}
        });
        Ext.regModel('excludedQuoteType', {
                fields: ['name','code'],
            belongTo:{model:'State',name:'State'}
        });    
            
        
        var login=new Ext.data.Store({
            model:'LicenseKey',
            autoLoad:true,
            method:GET,
            proxy:{
            type: 'ajax',
            url:
            reader:{
                type:'xml',
                record:'LicenseKey'
                
                }
            }
        });
        
        login.load({
            callback:function(){
             var user=login.first();
             var errors = login.validate();
                 console.log("Orders for " + user.get('licensedTo') + ":")
            }
        });
        
            
            
            
    </script>
      
      </head>
    
    <body>
    </body>
    </html>

  3. #3
    Touch Premium Member
    Join Date
    Mar 2008
    Location
    Morgan Hill, CA
    Posts
    126
    Vote Rating
    3
    margozzi is on a distinguished road

      0  

    Default


    I have a similar post I made back in May. Still waiting for a Sencha employee to comment.
    Sadly, i am beginning to think that they only respond to those who pay for support. Even though this seems to be to be a bug. Nested Models just flat out don't work in 4.0 :-(

    http://www.sencha.com/forum/showthre...riter&p=616813

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi