Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 44

Thread: xml reader- not able to trace my issue-help!

  1. #21
    Ext User
    Join Date
    Aug 2007
    Posts
    21

    Exclamation Breakpoint and headers

    1. I put the break point at the alert, waited for a few seconds still did not work.

    2. Current serverside code . Note the Headers are being set before xml is set. Still not working
    Code:
    import javax.servlet.http.*;
    
    public class AssignmentDownloadAction extends Action {
    
    	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    		ActionErrors errors = new ActionErrors();
    		ActionMessages msgs = new ActionMessages();
    		PrintWriter out = response.getWriter();	
    		// return value
    		response.setHeader("Cache-Control", "no-cache");	
    		response.setContentType("application/xml");	
    		
    			out.write("<?xml?>");
    		
    		
    		out.write("<dataset>  <Item> "+
    			"			<Author>RC Sproull</Author> " +
    			"		<Title>Are You Afraid of the Dark?</Title> " +
    			" 		<Manufacturer>Warner Books</Manufacturer> " +
    			"		<ProductGroup>Book</ProductGroup>  </Item>	" +
    		"		 <Item> 	<Author>Monergism </Author> " +
    		"		<Title>Commentary</Title> " +
    		" 		<Manufacturer>Warner Books</Manufacturer> " +
    		"		<ProductGroup>Book</ProductGroup> 	" +
    		
    			"	</Item> </dataset>");
    			
    
    		out.flush();
    		return null;
    
    	}
    }
    Last edited by ajay; 21 Aug 2007 at 6:45 AM. Reason: misc

  2. #22
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    @hcervantes - There are no results yet because the Ajax call is aynchronous and has not yet completed (ie: the load() call returns immediately) by the time:

    Ext.Msg.alert("test", ds.getTotalCount());

    is executed (without a BP).

    try something like:
    Code:
    ds.load({callback:function(){Ext.Msg.alert("test", ds.getTotalCount());}});
    the callback is fired after the response is received/loaded.

    or

    ds.on('load',function(){Ext.Msg.alert("test", ds.getTotalCount());})
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  3. #23
    Ext User
    Join Date
    Aug 2007
    Posts
    21

    Default AjaX On Result. Please see attachment

    please see attachement. No Errors returned
    Attached Images Attached Images

  4. #24
    Ext User
    Join Date
    Aug 2007
    Posts
    21

    Default

    Doug Hendricks,

    That was a good suggestion..

    dataStore.load({callback:function(){Ext.Msg.alert("test", dataStore.getTotalCount());}});


    I did get the alert with this but still no rows in the table and

    I do see XML returning correctly in Firebug response tab.

  5. #25
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    @ajay - may we also see the (response) Headers tab ?

    Also, examine (Browse in the DOM) the second parameter of the requestcomplete callback. Drill down to the responseXML property. Is it null, undefined ? Does the firstChild property nodeName = parsererror ?

    Keep drilling down till ya find it.

    And try saving your document statically first and use that as your source until you figure out how to generate the XML Doc properly serverside.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  6. #26
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Arrow

    Quote Originally Posted by ajay View Post

    I do see XML returning correctly in Firebug response tab.
    You will undoubtedly get a responseText value (that's just the raw text).

    The XMLReader uses the responseXML property of the response (a DOMDocument) to parse because it has nodes easily traversable.

    But, if your XML is not-well-formed or improperly encoded, a useful XMLDocument may not be created properly(at all).
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  7. #27
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Wink

    And please:

    Do Something like this:

    <?xml version="1.0" encoding="UTF-8"?>
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  8. #28
    Ext User
    Join Date
    Aug 2007
    Posts
    21

    Default headertab

    please see attachment for headers
    Attached Images Attached Images

  9. #29
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Exclamation Further:

    Code:
    	/**
     * @class Ext.data.XmlReader
     * @extends Ext.data.DataReader
     * Data reader class to create an Array of {@link Ext.data.Record} objects from an XML document
     * based on mappings in a provided Ext.data.Record constructor.<br><br>
     * <p>
     * <em>Note that in order for the browser to parse a returned XML document, the Content-Type
     * header in the HTTP response must be set to "text/xml".</em>
    Read the Source Notes !
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  10. #30
    Ext User
    Join Date
    Aug 2007
    Posts
    21

    Default WORKING!!!!!!!!!!!!!

    Thanks all.

    Not sure what did it. But among the many things I moved around..


    I suspect it was the suggestion by hendricd to set the xml encoding correctly..

    Someone. please correct the tutorial on the site.

    Thanks again all.

Page 3 of 5 FirstFirst 12345 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •