Jump to content

Jquery Specialists Unnara?


Recommended Posts

Posted

evarikina jquery dwaara XML ni parse cheyyadam vacha

naku vachu kani encoding unte cheyyalekapothunna
can any one help.

XMl is having stuff like this[CODE]
<link-code-html>&lt;a href="11496944"&gt;Rado Women's Florence Watch
Model: R48800713
Retail: $3,900
Special: $1,149 + Free Shipping
Coupon Code: AFFFLORE1149
Expires: 10/8 at 11:59 pm
&lt;/a&gt;&lt;img src="11496944" width="1" height="1" border="0"/&gt;</link-code-html>
[/CODE]

Posted

[color=#666666][size=4][i]
[b]Description: [/b]Parses a string into an XML document.[/i][/size][/color][list]
[*]
[b] [size=4]version added: [url="http://api.jquery.com/category/version/1.5/"]1.5[/url][/size][url="http://api.jquery.com/jQuery.parseXML/#jQuery-parseXML-data"]jQuery.parseXML( data )[/url][/b]
[list]
[*]
[b]data[/b]
Type: [url="http://api.jquery.com/Types/#String"]String[/url]
a well-formed XML string to be parsed
[/list]
[/list][color=#333333]

jQuery.parseXML uses the native parsing function of the browser to create a valid XML Document. This document can then be passed to jQuery to create a typical jQuery object that can be traversed and manipulated.[/color]
[b] Example:[/b]


[b] [color=#666666][size=4][i]Create a jQuery object using an XML string and obtain the value of the title node.[/i][/size][/color][/b]
[size=1][background=rgb(238, 238, 238)]
[size=1][right]
1[/right][/size] [size=1][right]
2[/right][/size] [size=1][right]
3[/right][/size] [size=1][right]
4[/right][/size] [size=1][right]
5[/right][/size] [size=1][right]
6[/right][/size] [size=1][right]
7[/right][/size] [size=1][right]
8[/right][/size] [size=1][right]
9[/right][/size] [size=1][right]
10[/right][/size] [size=1][right]
11[/right][/size] [size=1][right]
12[/right][/size] [size=1][right]
13[/right][/size] [size=1][right]
14[/right][/size] [size=1][right]
15[/right][/size] [size=1][right]
16[/right][/size] [size=1][right]
17[/right][/size] [size=1][right]
18[/right][/size] [size=1][right]
19[/right][/size] [size=1][right]
20[/right][/size] [size=1][right]
21[/right][/size] [size=1][right]
22[/right][/size] [size=1][right]
23[/right][/size] [size=1][right]
24[/right][/size] [size=1][right]
25[/right][/size] [size=1][right]
26[/right][/size] [size=1][right]
27[/right][/size] [size=1][right]
28[/right][/size] [size=1][right]
29[/right][/size] [size=1][right]
30[/right][/size]
[size=1]
[size=1]
[color=#999999][b]<!doctype html>[/b][/color][/size] [/size] [size=1]
[size=1]
[color=#000080]<html [color=#008080]lang[/color]=[color=#DD1144]"en"[/color]>[/color][/size] [/size] [size=1]
[size=1]
[color=#000080]<head>[/color][/size] [/size] [size=1]
[size=1]
[color=#000080]<meta [color=#008080]charset[/color]=[color=#DD1144]"utf-8"[/color]>[/color][/size] [/size] [size=1]
[size=1]
[color=#000080]<title>[/color]jQuery.parseXML demo[color=#000080]</title>[/color][/size] [/size] [size=1]
[size=1]
[color=#000080]<script [color=#008080]src[/color]=[color=#DD1144]"http://code.jquery.com/jquery-1.9.1.js"[/color]>[/color][color=#000080]</script>[/color][/size] [/size] [size=1]
[size=1]
[color=#000080]</head>[/color][/size] [/size] [size=1]
[size=1]
[color=#000080]<body>[/color][/size] [/size] [size=1]

[/size] [size=1]
[size=1]
[color=#000080]<p [color=#008080]id[/color]=[color=#DD1144]"someElement"[/color]>[/color][color=#000080]</p>[/color][/size] [/size] [size=1]
[size=1]
[color=#000080]<p [color=#008080]id[/color]=[color=#DD1144]"anotherElement"[/color]>[/color][color=#000080]</p>[/color][/size] [/size] [size=1]

[/size] [size=1]
[size=1]
[color=#000080]<script>[/color][/size] [/size] [size=1]
[size=1]
[b]var[/b] xml = [color=#DD1144]"<rss version='2.0'><channel><title>RSS Title</title></channel></rss>"[/color],[/size] [/size] [size=1]
[size=1]
xmlDoc = $.parseXML( xml ),[/size] [/size] [size=1]
[size=1]
$xml = $( xmlDoc ),[/size] [/size] [size=1]
[size=1]
$title = $xml.find( [color=#DD1144]"title"[/color] );[/size] [/size] [size=1]

[/size] [size=1]
[size=1]
[color=#999988][i]// Append "RSS Title" to #someElement[/i][/color][/size] [/size] [size=1]
[size=1]
$( [color=#DD1144]"#someElement"[/color] ).append( $title.text() );[/size] [/size] [size=1]

[/size] [size=1]
[size=1]
[color=#999988][i]// Change the title to "XML Title"[/i][/color][/size] [/size] [size=1]
[size=1]
$title.text( [color=#DD1144]"XML Title"[/color] );[/size] [/size] [size=1]

[/size] [size=1]
[size=1]
[color=#999988][i]// Append "XML Title" to #anotherElement[/i][/color][/size] [/size] [size=1]
[size=1]
$( [color=#DD1144]"#anotherElement"[/color] ).append( $title.text() );[/size] [/size] [size=1]
[size=1]
[color=#000080]</script>[/color][/size] [/size] [size=1]

[/size] [size=1]
[size=1]
[color=#000080]</body>[/color][/size] [/size] [size=1]
[size=1]
[color=#000080]</html>[/color][/size] [/size] [/background][/size]

Posted

[color=#000000][font=Arial,]
There is the $.parseXML function for this: [url="http://api.jquery.com/jQuery.parseXML/"]http://api.jquery.com/jQuery.parseXML/[/url][/font][/color][color=#000000][font=Arial,]
You can use it like this:[/font][/color]
[color=#00008B][background=transparent]var[/background][/color][background=transparent] xml [/background][background=transparent]=[/background][background=transparent] $[/background][background=transparent].[/background][background=transparent]parseXML[/background][background=transparent]([/background][background=transparent]yourfile[/background][background=transparent].[/background][background=transparent]xml[/background][background=transparent]),[/background][background=transparent]
$xml [/background][background=transparent]=[/background][background=transparent] $[/background][background=transparent]([/background][background=transparent] xml [/background][background=transparent]),[/background][background=transparent]
$test [/background][background=transparent]=[/background][background=transparent] $xml[/background][background=transparent].[/background][background=transparent]find[/background][background=transparent]([/background][color=#800000][background=transparent]'test'[/background][/color][background=transparent]);[/background][background=transparent]

console[/background][background=transparent].[/background][background=transparent]log[/background][background=transparent]([/background][background=transparent]$test[/background][background=transparent].[/background][background=transparent]text[/background][background=transparent]());[/background][color=#000000][font=Arial,]
If you really want an object, you need a plugin for that. This plugin for instance, will convert your XML to JSON: [url="http://www.fyneworks.com/jquery/xml-to-json/"]http://www.fyneworks.com/jquery/xml-to-json/[/url][/font][/color]

Posted

[quote name='iamlegend' timestamp='1381114199' post='1304362542']

[color=#000000][font=Arial,]There is the $.parseXML function for this: [url="http://api.jquery.com/jQuery.parseXML/"]http://api.jquery.com/jQuery.parseXML/[/url][/font][/color]
[color=#000000][font=Arial,]You can use it like this:[/font][/color]
[color=#00008B][background=transparent]var[/background][/color][background=transparent] xml [/background][background=transparent]=[/background][background=transparent] $[/background][background=transparent].[/background][background=transparent]parseXML[/background][background=transparent]([/background][background=transparent]yourfile[/background][background=transparent].[/background][background=transparent]xml[/background][background=transparent]),[/background]
[background=transparent] $xml [/background][background=transparent]=[/background][background=transparent] $[/background][background=transparent]([/background][background=transparent] xml [/background][background=transparent]),[/background]
[background=transparent] $test [/background][background=transparent]=[/background][background=transparent] $xml[/background][background=transparent].[/background][background=transparent]find[/background][background=transparent]([/background][color=#800000][background=transparent]'test'[/background][/color][background=transparent]);[/background]

[background=transparent]console[/background][background=transparent].[/background][background=transparent]log[/background][background=transparent]([/background][background=transparent]$test[/background][background=transparent].[/background][background=transparent]text[/background][background=transparent]());[/background]
[color=#000000][font=Arial,]If you really want an object, you need a plugin for that. This plugin for instance, will convert your XML to JSON: [url="http://www.fyneworks.com/jquery/xml-to-json/"]http://www.fyneworks...ry/xml-to-json/[/url][/font][/color]
[/quote]
idhi work kaledhu kabatte vesanu
can u try this XML and see if you can parse it

Posted

[url="http://stackoverflow.com/questions/19216127/unable-to-parse-encoded-text-in-xml-through-jquery-text/19216147?noredirect=1#comment28438618_19216147"]http://stackoverflow.com/questions/19216127/unable-to-parse-encoded-text-in-xml-through-jquery-text/19216147?noredirect=1#comment28438618_19216147[/url]

Posted

[quote name='bujjulu' timestamp='1381115271' post='1304362597']
[url="http://stackoverflow.com/questions/19216127/unable-to-parse-encoded-text-in-xml-through-jquery-text/19216147?noredirect=1#comment28438618_19216147"]http://stackoverflow...438618_19216147[/url]
[/quote]
ikkada vesanu

Posted

Replace your existing javascript for-each loop on the page with:

[color=#008000][i]$xml.find("link").each(function () {[/i][/color]
[color=#008000][i] var $this = $(this);[/i][/color]
[color=#008000][i] var tempTitle = $this.find("description").text();[/i][/color]
[color=#008000][i] var urlStr = $this.find("link-code-html").text();[/i][/color]

[color=#008000][i] if (urlStr != null && urlStr.length > 0) {[/i][/color]
[color=#008000][i] htmlString += "<tr><td width=30%> " + "<div class='block richtext'>" + tempTitle + "<br>" + urlStr + "</div></td></tr>";[/i][/color]
[color=#008000][i] }[/i][/color]
[color=#008000][i]});[/i][/color]
[color=#008000][i]htmlString += "</table>";[/i][/color]
[color=#008000][i]document.getElementById("someElement").innerHTML = htmlString;[/i][/color]

Hope this helps :)

Posted

try to use unicode ......................... sSc_hidingsofa

Posted

[quote name='snowman' timestamp='1381139911' post='1304363557']
Replace your existing javascript for-each loop on the page with:

[color=#008000][i]$xml.find("link").each(function () {[/i][/color]
[color=#008000][i] var $this = $(this);[/i][/color]
[color=#008000][i] var tempTitle = $this.find("description").text();[/i][/color]
[color=#008000][i] var urlStr = $this.find("link-code-html").text();[/i][/color]

[color=#008000][i] if (urlStr != null && urlStr.length > 0) {[/i][/color]
[color=#008000][i] htmlString += "<tr><td width=30%> " + "<div class='block richtext'>" + tempTitle + "<br>" + urlStr + "</div></td></tr>";[/i][/color]
[color=#008000][i] }[/i][/color]
[color=#008000][i]});[/i][/color]
[color=#008000][i]htmlString += "</table>";[/i][/color]
[color=#008000][i]document.getElementById("someElement").innerHTML = htmlString;[/i][/color]

Hope this helps :)
[/quote]
Anni try lu ayyake ikada stack trace lo post chesanu
Can u work one this test and see if it works for you.
Please post after working.

Dheeni walla mana wallaki oka useful page undi pothadi
Coupon search. service vadu normal text kakunda encoding text pampisthunnadu

×
×
  • Create New...