facebook

Data Access in Mobione App

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #317348 Reply

    kazzouny
    Member

    Hi,

    I’m trying to develope an App that displays poems from diffrent books of a Poet, and want to retrive these poems dinamically through some data structre.
    I tried using XML, it works on the emulator and on Chrome browser, but doesn’t work on Iphone.

    below the two functions that acess the XML file

    function loadXMLDoc(dname)
    {
    if (window.XMLHttpRequest)
    {
    xhttp=new XMLHttpRequest();
    }
    else
    {
    xhttp=new ActiveXObject(“Microsoft.XMLHTTP”);
    }
    xhttp.open(“GET”,dname,false);
    xhttp.send();
    return xhttp.responseXML;
    }

    function changeText()
    {

    xmlDoc=loadXMLDoc(“books_new.xml”);

    x=xmlDoc.documentElement.childNodes;

    var MyTxt = “<ul id=\”m1-Diwan-listD2\” class=\”m1-rounded-list m1-list\”>”
    MyTxt = MyTxt + “<li id=\”m1-Diwan-listHeaderD2\” class=\”m1-list-header\”><label id=\”m1-Diwan-listHeader2-label\”>Header</label></li>”

    for (i=0;i<x.length;i++)
    {

    if (x[i].nodeType==1)
    {

    if(i == 0)
    {
    MyTxt = MyTxt + “<li id=\”m1-Diwan-TopListItem\” class=\”m1-first m1-clickable m1-hyperlink\” href=\”#Poem?NodeID=”+i+”:DEFAULT\”>”
    MyTxt = MyTxt + “<img id=\”m1-Diwan-accessoryImageD”+i+”\” class=\”Dimg\” src=\”res/images/tableRowDisclosureIndicator.png\”/>”
    MyTxt = MyTxt + “<div id=\”m1-Diwan-textAD”+i+”\” class=\”m1-text\”>”+x[i].childNodes.item(0).text+”</div></li>”
    }

    else if(i == x -1)
    {

    MyTxt = MyTxt + “<li id=\”m1-Diwan-listItemD”+i+”\” class=\”m1-last m1-clickable m1-hyperlink\” href=\”#Poem?NodeID=”+i+”:DEFAULT\”>”
    MyTxt = MyTxt + “<img id=\”m1-Diwan-accessoryImageD”+i+”\” class=\”Dimg\” src=\”res/images/tableRowDisclosureIndicator.png\”/>”
    MyTxt = MyTxt + “<div id=\”m1-Diwan-textAD”+i+”\” class=\”m1-text\”>”+x[i].childNodes.item(0).text+”</div></li>”

    }

    else

    {
    MyTxt = MyTxt + “<li id=\”m1-Diwan-BottomListItem\” class=\”m1-clickable m1-hyperlink\” href=\”#Poem?NodeID=”+i+”:DEFAULT\”>”
    MyTxt = MyTxt + “<img id=\”m1-Diwan-accessoryImageD”+i+”\” class=\”Dimg\” src=\”res/images/tableRowDisclosureIndicator.png\”/>”
    MyTxt = MyTxt + “<div id=\”m1-Diwan-textAD”+i+”\” class=\”m1-text\”>”+x[i].childNodes.item(0).text+”</div></li>”

    }

    }
    }

    MyTxt = MyTxt + “<li id=\”m1-Diwan-listFooterD1\” class=\”m1-list-footer\”>”
    MyTxt = MyTxt + “<label id=\”m1-Diwan-listFooter1-labelD\”>Fotter</label>”
    MyTxt = MyTxt + “</li></ul>”

    document.getElementById(“m1-Diwan-“).innerHTML = MyTxt;

    }

    Is this the best option? and what is wronge with this code ?

Viewing 1 post (of 1 total)
Reply To: Data Access in Mobione App

You must be logged in to post in the forum log in