Parse java script code in C# language for WM development?

Parse java script code in C# language for WM development?

Page 1 of 1

4 Replies - 573 Views - Last Post: 28 January 2010 - 06:32 AM Rate Topic: -----

#1 Martin_8177  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-January 10

Parse java script code in C# language for WM development?

Posted 28 January 2010 - 02:34 AM

Hello,

I am developing a Windows Mobile application using C# language on 6.0 standard SDK for smartphone. I am accessing a web request programmatically and getting Java script code from that URL as contents. I want to parse a Java script code in my app. Can someone help me on giving some examples to know how can parse java script code in C# language for WM development.

Thanks.

Martin.
Is This A Good Question/Topic? 0
  • +

Replies To: Parse java script code in C# language for WM development?

#2 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Parse java script code in C# language for WM development?

Posted 28 January 2010 - 02:37 AM

Can you post a sample of this javascript text you are getting.
Was This Post Helpful? 0
  • +
  • -

#3 Martin_8177  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-January 10

Re: Parse java script code in C# language for WM development?

Posted 28 January 2010 - 02:43 AM

View PostFlashM, on 28 Jan, 2010 - 01:37 AM, said:

Can you post a sample of this javascript text you are getting.



It is ticker from http://www.appuonlin...nse-ticker.html website. I need to parse <company name,number of shares, value [percentage]>

Here it is:

[code]<script language="Javascript">
function fast_bse(scrol_bse)
{if(scrol_bse == 'fast'){if(document.getElementById("scroller1").scrollAmount <= 16)
{
var scrol_amount = document.getElementById("scroller1").scrollAmount;
if(scrol_amount == 16)
{
document.getElementById("scroller1").scrollAmount = scrol_amount;

}
else
{
scrol_amount = scrol_amount * 2;
document.getElementById("scroller1").scrollAmount = scrol_amount;
}
}
}if(scrol_bse == 'slow'){var scrol_amount = document.getElementById("scroller1").scrollAmount;
if((document.getElementById("scroller1").scrollAmount > 2) && (document.getElementById("scroller1").scrollAmount <= 16))
{
var scrol_amount = document.getElementById("scroller1").scrollAmount;
scrol_amount = scrol_amount / 2;
document.getElementById("scroller1").scrollAmount = scrol_amount;
}
else
{
document.getElementById("scroller1").scrollAmount = 2;
}
}
}
</SCRIPT><link href="/stylesheet.css" rel="stylesheet" type="text/css"><TABLE cellSpacing=0 cellPadding=0 border=0><tr><TD class="inp"><B>NSE</B>&nbsp;&nbsp;</TD><td BGCOLOR="#f4f4f4"><marquee id="scroller1" class="lft-nav-hd-Text" scrollamount="3" scrolldelay="4" height="22" onmouseover="this.stop()" onmouseout="this.start()"><div class=TickerTxt>Thursday, January 28, 2010 03:09:02 PM, NSE Ticker :: &nbsp;<a href="/nse/nseshareprice.php?company_name=ABB" target="_blank">ABB&nbsp;&nbsp;<B>788</B>&nbsp;&nbsp;<font color="GREEN">9.55&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[1.23 %]</font></a><a href="/nse/nseshareprice.php?company_name=ACC" target="_blank">ACC&nbsp;&nbsp;<B>869</B>&nbsp;&nbsp;<font color="red">-12.9&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-1.46 %]</font></a><a href="/nse/nseshareprice.php?company_name=AMBUJACEM" target="_blank">AMBUJACEM&nbsp;&nbsp;<B>102.5</B>&nbsp;&nbsp;<font color="GREEN">0.9&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[0.89 %]</font></a><a href="/nse/nseshareprice.php?company_name=AXISBANK" target="_blank">AXISBANK&nbsp;&nbsp;<B>1010.25</B>&nbsp;&nbsp;<font color="GREEN">37.5&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[3.86 %]</font></a><a href="/nse/nseshareprice.php?company_name=BHARTIARTL" target="_blank">BHARTIARTL&nbsp;&nbsp;<B>313.1</B>&nbsp;&nbsp;<font color="red">-9.8&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-3.03 %]</font></a><a href="/nse/nseshareprice.php?company_name=BHEL" target="_blank">BHEL&nbsp;&nbsp;<B>2345.05</B>&nbsp;&nbsp;<font color="GREEN">1.9&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[0.08 %]</font></a><a href="/nse/nseshareprice.php?company_name=BPCL" target="_blank">BPCL&nbsp;&nbsp;<B>542.15</B>&nbsp;&nbsp;<font color="red">-12.3&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-2.22 %]</font></a><a href="/nse/nseshareprice.php?company_name=CAIRN" target="_blank">CAIRN&nbsp;&nbsp;<B>269.4</B>&nbsp;&nbsp;<font color="GREEN">2.05&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[0.77 %]</font></a><a href="/nse/nseshareprice.php?company_name=CIPLA" target="_blank">CIPLA&nbsp;&nbsp;<B>322.45</B>&nbsp;&nbsp;<font color="GREEN">8.95&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[2.85 %]</font></a><a href="/nse/nseshareprice.php?company_name=DLF" target="_blank">DLF&nbsp;&nbsp;<B>325.9</B>&nbsp;&nbsp;<font color="GREEN">8.45&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[2.66 %]</font></a><a href="/nse/nseshareprice.php?company_name=GAIL" target="_blank">GAIL&nbsp;&nbsp;<B>399.75</B>&nbsp;&nbsp;<font color="GREEN">8.85&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[2.26 %]</font></a><a href="/nse/nseshareprice.php?company_name=GRASIM" target="_blank">GRASIM&nbsp;&nbsp;<B>2613.8</B>&nbsp;&nbsp;<font color="GREEN">44.6&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[1.74 %]</font></a><a href="/nse/nseshareprice.php?company_name=HCLTECH" target="_blank">HCLTECH&nbsp;&nbsp;<B>349.1</B>&nbsp;&nbsp;<font color="GREEN">18.9&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[5.72 %]</font></a><a href="/nse/nseshareprice.php?company_name=HDFC" target="_blank">HDFC&nbsp;&nbsp;<B>2353.9</B>&nbsp;&nbsp;<font color="GREEN">48.35&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[2.1 %]</font></a><a href="/nse/nseshareprice.php?company_name=HDFCBANK" target="_blank">HDFCBANK&nbsp;&nbsp;<B>1594.25</B>&nbsp;&nbsp;<font color="red">-2.95&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-0.18 %]</font></a><a href="/nse/nseshareprice.php?company_name=HEROHONDA" target="_blank">HEROHONDA&nbsp;&nbsp;<B>1545</B>&nbsp;&nbsp;<font color="red">-5.15&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-0.33 %]</font></a><a href="/nse/nseshareprice.php?company_name=HINDALCO" target="_blank">HINDALCO&nbsp;&nbsp;<B>148.15</B>&nbsp;&nbsp;<font color="red">-1.9&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-1.27 %]</font></a><a href="/nse/nseshareprice.php?company_name=HINDUNILVR" target="_blank">HINDUNILVR&nbsp;&nbsp;<B>255.75</B>&nbsp;&nbsp;<font color="red">-3.6&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-1.39 %]</font></a><a href="/nse/nseshareprice.php?company_name=ICICIBANK" target="_blank">ICICIBANK&nbsp;&nbsp;<B>788.3</B>&nbsp;&nbsp;<font color="GREEN">1&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[0.13 %]</font></a><a href="/nse/nseshareprice.php?company_name=IDEA" target="_blank">IDEA&nbsp;&nbsp;<B>59.55</B>&nbsp;&nbsp;<font color="red">-0.75&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-1.24 %]</font></a><a href="/nse/nseshareprice.php?company_name=IDFC" target="_blank">IDFC&nbsp;&nbsp;<B>148.85</B>&nbsp;&nbsp;<font color="GREEN">3.25&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[2.23 %]</font></a><a href="/nse/nseshareprice.php?company_name=INFOSYSTCH" target="_blank">INFOSYSTCH&nbsp;&nbsp;<B>2485</B>&nbsp;&nbsp;<font color="red">-17.25&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-0.69 %]</font></a><a href="/nse/nseshareprice.php?company_name=ITC" target="_blank">ITC&nbsp;&nbsp;<B>253.6</B>&nbsp;&nbsp;<font color="red">-2.3&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-0.9 %]</font></a><a href="/nse/nseshareprice.php?company_name=JINDALSTEL" target="_blank">JINDALSTEL&nbsp;&nbsp;<B>650.5</B>&nbsp;&nbsp;<font color="GREEN">4.9&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[0.76 %]</font></a><a href="/nse/nseshareprice.php?company_name=JPASSOCIAT" target="_blank">JPASSOCIAT&nbsp;&nbsp;<B>135.3</B>&nbsp;&nbsp;<font color="red">-1.8&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-1.31 %]</font></a><a href="/nse/nseshareprice.php?company_name=LT" target="_blank">LT&nbsp;&nbsp;<B>1433.15</B>&nbsp;&nbsp;<font color="red">-24.9&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-1.71 %]</font></a><a href="/nse/nseshareprice.php?company_name=M&amp;M" target="_blank">M&amp;M&nbsp;&nbsp;<B>1027.4</B>&nbsp;&nbsp;<font color="GREEN">16.5&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[1.63 %]</font></a><a href="/nse/nseshareprice.php?company_name=MARUTI" target="_blank">MARUTI&nbsp;&nbsp;<B>1386</B>&nbsp;&nbsp;<font color="GREEN">16.2&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[1.18 %]</font></a><a href="/nse/nseshareprice.php?company_name=NTPC" target="_blank">NTPC&nbsp;&nbsp;<B>214.05</B>&nbsp;&nbsp;<font color="red">-2.45&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-1.13 %]</font></a><a href="/nse/nseshareprice.php?company_name=ONGC" target="_blank">ONGC&nbsp;&nbsp;<B>1078.5</B>&nbsp;&nbsp;<font color="red">-30.4&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-2.74 %]</font></a><a href="/nse/nseshareprice.php?company_name=PNB" target="_blank">PNB&nbsp;&nbsp;<B>884.9</B>&nbsp;&nbsp;<font color="GREEN">24.1&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[2.8 %]</font></a><a href="/nse/nseshareprice.php?company_name=POWERGRID" target="_blank">POWERGRID&nbsp;&nbsp;<B>109.6</B>&nbsp;&nbsp;<font color="red">-3.7&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-3.27 %]</font></a><a href="/nse/nseshareprice.php?company_name=RANBAXY" target="_blank">RANBAXY&nbsp;&nbsp;<B>451.05</B>&nbsp;&nbsp;<font color="GREEN">10.15&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[2.3 %]</font></a><a href="/nse/nseshareprice.php?company_name=RCOM" target="_blank">RCOM&nbsp;&nbsp;<B>173.2</B>&nbsp;&nbsp;<font color="red">-1.55&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-0.89 %]</font></a><a href="/nse/nseshareprice.php?company_name=RELCAPITAL" target="_blank">RELCAPITAL&nbsp;&nbsp;<B>793.2</B>&nbsp;&nbsp;<font color="GREEN">4.6&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[0.58 %]</font></a><a href="/nse/nseshareprice.php?company_name=RELIANCE" target="_blank">RELIANCE&nbsp;&nbsp;<B>1039.4</B>&nbsp;&nbsp;<font color="GREEN">11.85&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[1.15 %]</font></a><a href="/nse/nseshareprice.php?company_name=RELINFRA" target="_blank">RELINFRA&nbsp;&nbsp;<B>1041.4</B>&nbsp;&nbsp;<font color="GREEN">8.8&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[0.85 %]</font></a><a href="/nse/nseshareprice.php?company_name=RPOWER" target="_blank">RPOWER&nbsp;&nbsp;<B>146.5</B>&nbsp;&nbsp;<font color="GREEN">1.05&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[0.72 %]</font></a><a href="/nse/nseshareprice.php?company_name=SAIL" target="_blank">SAIL&nbsp;&nbsp;<B>219.7</B>&nbsp;&nbsp;<font color="GREEN">3.85&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[1.78 %]</font></a><a href="/nse/nseshareprice.php?company_name=SBIN" target="_blank">SBIN&nbsp;&nbsp;<B>2009.95</B>&nbsp;&nbsp;<font color="GREEN">22.3&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[1.12 %]</font></a><a href="/nse/nseshareprice.php?company_name=SIEMENS" target="_blank">SIEMENS&nbsp;&nbsp;<B>615.55</B>&nbsp;&nbsp;<font color="GREEN">21.4&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[3.6 %]</font></a><a href="/nse/nseshareprice.php?company_name=STER" target="_blank">STER&nbsp;&nbsp;<B>763.5</B>&nbsp;&nbsp;<font color="red">-4.4&nbsp;<img src="/gifs/ticker_down.gif">&nbsp;&nbsp;[-0.57 %]</font></a><a href="/nse/nseshareprice.php?company_name=SUNPHARMA" target="_blank">SUNPHARMA&nbsp;&nbsp;<B>1476.9</B>&nbsp;&nbsp;<font color="GREEN">55.9&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[3.93 %]</font></a><a href="/nse/nseshareprice.php?company_name=SUZLON" target="_blank">SUZLON&nbsp;&nbsp;<B>74.35</B>&nbsp;&nbsp;<font color="GREEN">1.15&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[1.57 %]</font></a><a href="/nse/nseshareprice.php?company_name=TATAMOTORS" target="_blank">TATAMOTORS&nbsp;&nbsp;<B>719.8</B>&nbsp;&nbsp;<font color="GREEN">1.85&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[0.26 %]</font></a><a href="/nse/nseshareprice.php?company_name=TATAPOWER" target="_blank">TATAPOWER&nbsp;&nbsp;<B>1326.6</B>&nbsp;&nbsp;<font color="GREEN">14.85&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[1.13 %]</font></a><a href="/nse/nseshareprice.php?company_name=TATASTEEL" target="_blank">TATASTEEL&nbsp;&nbsp;<B>584.65</B>&nbsp;&nbsp;<font color="GREEN">25&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[4.47 %]</font></a><a href="/nse/nseshareprice.php?company_name=TCS" target="_blank">TCS&nbsp;&nbsp;<B>743.35</B>&nbsp;&nbsp;<font color="GREEN">0.0500000000001&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[0.01 %]</font></a><a href="/nse/nseshareprice.php?company_name=UNITECH" target="_blank">UNITECH&nbsp;&nbsp;<B>72.9</B>&nbsp;&nbsp;<font color="GREEN">2.15&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[3.04 %]</font></a><a href="/nse/nseshareprice.php?company_name=WIPRO" target="_blank">WIPRO&nbsp;&nbsp;<B>674.1</B>&nbsp;&nbsp;<font color="GREEN">18.7&nbsp;<img src="/gifs/ticker_up.gif">&nbsp;&nbsp;[2.85 %]</font></a> :: Powered by Appuonline.com</div></MARQUEE></td><TD class="lft-nav-hd bb"><a href="java script:fast_bse('slow');"><img border="0" src="/gifs/nsefast.gif"></a></td><TD class="lft-nav-hd bb"><a href="java script:fast_bse('fast');"><img border="0" src="/gifs/nseslow.gif"></a></td></a></td></tr></table><script language="Javascript">var w;
if(screen.width == 800)
{
w = 300;
document.getElementById('scroller1').style.width = w;
}

if(screen.width == 1024)
{
w = 300;
document.getElementById('scroller1').style.width = w;

}
if(screen.width == 1280)
{
w = 300;
document.getElementById('scroller1').style.width = w;
}
else
{
w = 300;
document.getElementById('scroller1').style.width = w;
}

</SCRIPT>
Was This Post Helpful? 0
  • +
  • -

#4 Martin_8177  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-January 10

Re: Parse java script code in C# language for WM development?

Posted 28 January 2010 - 04:13 AM

Any Help?
Problem why i'm trying to get content from web request and parse it is, i initially used 'Web Browser' control and tried to access http://www.appuonlin...nse-ticker.html web page. But it doesn't result as same as this web site really shows on the desktop pc, becuase it has Ticker scrolling by using Marquee and Java script code. So i couldn't access and get the same feel using on 'Web Browser' control from SDK. So i shifted to access this web page by doing http request and get the data and parse the contents.

Am i doing anything wrong?
Was This Post Helpful? 0
  • +
  • -

#5 Adkins  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 66
  • View blog
  • Posts: 560
  • Joined: 27-October 09

Re: Parse java script code in C# language for WM development?

Posted 28 January 2010 - 06:32 AM

This is all purly guess work and suggestions as to where to start, but I think if you could break that whole thing into strings delimited by "<a" that should give you chunks to work with. From there you can further manipulate the strings to pull out just the info you want and not all the extra garbage. This is a completely elementary way to do it, but if you don't get any better suggestions it should give you something to get it running while you research
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1