Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/375.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我可以在winjs中获取blob和text类型的数据。现在我想获取json类型。我必须将json数据转换为XML格式 //获取文本类型的步骤 WinJS.xhr({url:http://www.sportskeeda.com/2013/01/15/flu_Javascript_Winjs - Fatal编程技术网

Javascript 我可以在winjs中获取blob和text类型的数据。现在我想获取json类型。我必须将json数据转换为XML格式 //获取文本类型的步骤 WinJS.xhr({url:http://www.sportskeeda.com/2013/01/15/flu

Javascript 我可以在winjs中获取blob和text类型的数据。现在我想获取json类型。我必须将json数据转换为XML格式 //获取文本类型的步骤 WinJS.xhr({url:http://www.sportskeeda.com/2013/01/15/flu,javascript,winjs,Javascript,Winjs,我可以在winjs中获取blob和text类型的数据。现在我想获取json类型。我必须将json数据转换为XML格式 //获取文本类型的步骤 WinJS.xhr({url:http://www.sportskeeda.com/2013/01/15/fluminense-in-talks-with- riquelme/”,响应类型:“text”}) .完成( 功能(请求){ var text=request.responseText; var subText=text.substri

我可以在winjs中获取blob和text类型的数据。现在我想获取json类型。我必须将json数据转换为XML格式

//获取文本类型的步骤
WinJS.xhr({url:http://www.sportskeeda.com/2013/01/15/fluminense-in-talks-with-       riquelme/”,响应类型:“text”})
.完成(
功能(请求){
var text=request.responseText;
var subText=text.substring(text.indexOf(“巴西”)、text.indexOf(“新华社”)+9);
xhrDiv.innerHTML=子文本;
});
//获取blob类型的步骤
WinJS.xhr({url:http://www.microsoft.com/windows/Framework/images/win_logo.png,响应类型:“blob”})
.完成(
功能(请求){
var imageBlob=URL.createObjectURL(request.response);
var imageTag=xhrDiv.appendChild(document.createElement(“image”));
imageTag.src=imageBlob;
});

你能澄清你的问题吗?我不太明白你想做什么?您有一些数据,想要将其转换为XML?您需要从您请求的JSON构建XML文档。这是为了上传一些XML吗?我使用XML从网站提取数据,现在我想将相同的数据推送到windows 8应用程序。怎么走?我建议看看这个答案:对不起,但你真的需要比“它不起作用”更具体一些。你的意思是:A)来自服务的数据永远不会完成b)当你试图操作XML的DOM时无法解析它c)它与你试图解决的实际问题无关?
  <script src="/js/default.js"></script>
    </head>
    <body>
    <div id="xhrDiv"></div>
    <script type="text/javascript">

    //to fetch text type

    WinJS.xhr({ url: "http://www.sportskeeda.com/2013/01/15/fluminense-in-talks-with-       riquelme/", responseType: "text" })
   .done(
     function (request) {
     var text = request.responseText;
     var subText = text.substring(text.indexOf("Brazilian"), text.indexOf("Xinhua.") + 9);
     xhrDiv.innerHTML = subText;
     });

     // to fetch blob type

     WinJS.xhr({ url: "http://www.microsoft.com/windows/Framework/images/win_logo.png",    responseType: "blob" })
     .done(
     function (request) {
     var imageBlob = URL.createObjectURL(request.response);
     var imageTag = xhrDiv.appendChild(document.createElement("image"));
     imageTag.src = imageBlob;
     });

    </script>