locked
Serializable xml for use template tile Windows 8 app

    Question

  • hi, everybody!

    i really a newbe in W8 apps, i been try to use a XML in the web service, for take the data that will be consume in template for a tile, but i cant find a well example that show me how to use this. i dont wanna parse to json, i have this function but the problem is that funcion return every node and post in the page, and i try to made serealizable, im not sure if i been completely clear. i really appreciate your help, and if posible an answer simple, for junir developer. thanks

     

     function xhrParseFeedXml(xml, statusCode) {
            document.getElementById("postMessageLocalData").innerHTML = "";
            if (xml) {
                var items = xml.querySelectorAll("Response > GameList> GM");                   

                var length = items.length;
                var x = xml.getElementsByTagName('RRL');
                for (var i = 0; i < length; i++) {
                    var feedItem = new rssFeedItem();
                    feedItem.text = items[i].querySelector("SN").textContent;               
                    feedItem.calif = x[i].getAttribute('AverageRate');
                    feed.push(feedItem);
                    var newLine = document.createElement("br");
                    var text = document.createElement("span");
                    var calif = document.createElement("span");

                    text.innerText = feedItem.text;
                    calif.innerText = feedItem.calif;

                    document.getElementById("postMessageLocalData").appendChild(newLine);
                    document.getElementById("postMessageLocalData").appendChild(calif);
                    document.getElementById("postMessageLocalData").appendChild(text);
                   
                }

     

     

    Monday, June 3, 2013 10:51 PM

Answers

  • well last looking for a lot, i has made with other way, using json, in this case im manitulate a XML, so made convert my XML to json like that, i hope be a helpful this code like me:

    document.getElementById("postMessageLocalData").innerHTML = "";
            var jsonO= new jsonOItem();
            var items = xml.querySelectorAll("treeNode>treeNode");      
           for (var i = 0; yourjsonObj < length; i++) {
                jsonO.text = items[i].querySelector("node").textContent;
                var name = jsonO.text;
                yourjsonObj.push(parse(name));
            }

    function parse(name2) {
       var result= { "title": name2};
       return result;
    }


    Wednesday, June 5, 2013 10:56 PM

All replies

  • Emmanuel Hi

    This is a Spanish Forum so i'm moving this question to the correct one so you can get the help that you need.

    Regards


    Recuerda proponer o marcar toda respuesta que haya solucionado tu consulta, votar como útil o agradecer
    al usuario que te proporciono la mejor opción para asi apoyar a nuestra comunidad y esta siga creciendo.


    Omar Ortiz Suárez
    Microsoft Contingent Staff
    Mexico City

    Wednesday, June 5, 2013 5:04 PM
  • This is not the right forum either, can this be moved to HTML5/JavaScript forum please?

    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you.

    Happy Coding!!!

    Wednesday, June 5, 2013 6:38 PM
  • well last looking for a lot, i has made with other way, using json, in this case im manitulate a XML, so made convert my XML to json like that, i hope be a helpful this code like me:

    document.getElementById("postMessageLocalData").innerHTML = "";
            var jsonO= new jsonOItem();
            var items = xml.querySelectorAll("treeNode>treeNode");      
           for (var i = 0; yourjsonObj < length; i++) {
                jsonO.text = items[i].querySelector("node").textContent;
                var name = jsonO.text;
                yourjsonObj.push(parse(name));
            }

    function parse(name2) {
       var result= { "title": name2};
       return result;
    }


    Wednesday, June 5, 2013 10:56 PM
  • HI Emmanuel

    I moved this thread to HTML5/Javascript forum, I hope you can get more help here.

    But it seems you already have the solution.

    Best Regards


    James He
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Tuesday, June 11, 2013 4:54 AM
    Moderator