1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    8
    Vote Rating
    0
    Rich is on a distinguished road

      0  

    Default Trouble getting started with Grid and XML

    Trouble getting started with Grid and XML


    I'm trying to implement a grid to display XML data, using the http://www.jackslocum.com/yui/2006/0...hoo-ui-part-2/ example as a starting point.

    I've created a simple page with the code, here:

    http://richgay.com/test/gridtest.html

    The page loads and the grid header displays, but no rows, and an error in Firefox 2.0/Mac:

    Code:
    Error: junk after document element
    Source File: http://richgay.com/test/serverconfigdata.xml
    Line: 8, Column: 1
    Source Code:
    <item>^
    With Safari, the header and first row displays, and there is no error displayed in the Javascript console.

    No doubt I've made a fundamental mistake... thanks in advance for any help.

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    Is the xml valid? Maybe just a stray quote? If you open the xml file in IE, does it choke?

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    8
    Vote Rating
    0
    Rich is on a distinguished road

      0  

    Default


    Quote Originally Posted by tryanDLS
    Is the xml valid? Maybe just a stray quote? If you open the xml file in IE, does it choke?
    You were on the right track. The XML for the items needed to be wrapped. It's working now.

  4. #4
    Ext User
    Join Date
    Mar 2007
    Posts
    8
    Vote Rating
    0
    Rich is on a distinguished road

      0  

    Default


    I'm trying to modify my grid to load the XML data from a hidden div in the page, rather than issue a separate page request.

    Previously, to load the xml from a document, I used:

    Code:
    this.dataModel.load('serverconfigdata.xml');
    I've changed to this:

    Code:
    var myXMLdiv = document.getElementById ("xmlcontent");
    var myXMLcontent = myXMLdiv.innerHTML;
    this.dataModel.loadData (myXMLcontent);
    I'm getting this error in the yui-ext library:

    Code:
    Error: doc.getElementsByTagName is not a function
    Source File: http://richgay.com/test/scripts/yui-...rc1/yui-ext.js
    Line: 482
    I'm certain I'm doing something incorrectly here...

    Page with the code is here:

    http://richgay.com/test/gridtest.html

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,501
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Off the top of my head, try

    Code:
    this.dataModel.loadData (myXMLcontent.documentElement);

  6. #6
    Ext User
    Join Date
    Mar 2007
    Posts
    8
    Vote Rating
    0
    Rich is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal
    Off the top of my head, try

    Code:
    this.dataModel.loadData (myXMLcontent.documentElement);
    No success, but a different error reported:

    Code:
    Error: doc has no properties
    Source File: http://richgay.com/test/scripts/yui-...rc1/yui-ext.js
    Line: 482

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,501
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Stop in the Connection object and take a look at the XmlHttpRequest's properties.

    It's a very fussy XML parser, and it gives you a null document if anything's wrong.

  8. #8
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,501
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Oh, I just saw that you're passing in HTML from a div. Are you sure that the browser is preserving the XML that you put there?

    I think the only way to preserve XML text in an HTML document is to send it out inside a textbox. Then you can get the value of that.

  9. #9
    Ext User
    Join Date
    Mar 2007
    Posts
    8
    Vote Rating
    0
    Rich is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal
    Oh, I just saw that you're passing in HTML from a div. Are you sure that the browser is preserving the XML that you put there?
    It appears to be correct. If I view the source of the page, it appears intact.

    Quote Originally Posted by Animal
    I think the only way to preserve XML text in an HTML document is to send it out inside a textbox. Then you can get the value of that.
    I'll give that a try... after lunch.

    Thanks for the suggestions!

  10. #10
    Ext User
    Join Date
    Mar 2007
    Posts
    8
    Vote Rating
    0
    Rich is on a distinguished road

      0  

    Default


    I've modified the included XML to be wrapped with an <xml> tag, and verified the content is included and correct. Still getting this error:

    Code:
    Error: doc.getElementsByTagName is not a function
    Source File: http://richgay.com/test/scripts/yui-...rc1/yui-ext.js
    Line: 482

Similar Threads

  1. trouble passing grid info via seletionchange
    By pjordan in forum Ext 1.x: Help & Discussion
    Replies: 9
    Last Post: 16 Mar 2007, 4:33 AM
  2. Trouble adding rows to grid manually.
    By kjordan in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 9 Mar 2007, 3:22 PM
  3. Grid layout trouble
    By Belgabor in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 25 Feb 2007, 3:21 PM
  4. trouble using Grid and LayoutDialog with a grid?
    By franklt69 in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 3 Feb 2007, 4:25 PM
  5. Grid: Getting Started !
    By allaboutyui in forum Community Discussion
    Replies: 0
    Last Post: 16 Nov 2006, 9:04 AM

Thread Participants: 3

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