c#


Parsing PHP page for an ios application using Linq and Html Agility Pack


<tr id="5" class="altRow ">
<td>37</td>
<td>$CUSTOM_MESSAGE_13$</td>
<td>0</td>
<td></td>
</tr>
Hello everyone, I'm working on an iOS application with Xamarin and I need to retrieve a value in a php page and since I can't use Xpath code in Xamarin, I must use Linq to get the value 0 below $CUSTOM_MESSAGE_13$ in the code above. Can someone help me please?
I tried to use the code below but I don't know how to complete it.
var msg =
(from td in html.DocumentNode.Descendants("td")
where td.InnerText.ToLower() == "$CUSTOM_MESSAGE_13$"
select td).FirstOrDefault();
var info = msg.ToString();
TextE1.Text = info;
I tried to use this tutorial but I think the problem is that the 0 is in the same node that $CUSTOM_MESSAGE_13$ and I don't know how to return it.
Another precision, the value I try to return is in a table but I don't know how to extract it.
Link of the screenshot of the table
Linq isn't the right tool to scan sequentially through data. And theoretically the Descendants() function could return the td elements in any order. But try something like:
var tds = html.DocumentNode.Descendants("td").ToArray();
var msg = tds[Array.FindIndex(td => td.ToUpper() == "$CUSTOM_MESSAGE_13$")+1];
var info = msg.ToString();
TextE1.Text = info;

Related Links

Windows Service: Managed Compatibility Mode does not support Edit and Continue
Accessing controls of default EditTemplate Textboxes of a GridView + RowCommand Updating
Combobox Shows Type Name Instead of Display Name in Property Grid (Xceed WPF Toolkit)
Does creating a GUILayoutOption allocate memory?
Windows Forms show string letter by letter
column \“Id\” violates not-null constraint"
XML Schema Union getting “string” is not valid for the element error
How to group linq query by dynamic items
How to get name of roles in Views from IdentityUser in asp.net mvc? [duplicate]
Get unique vertices from unity mesh but keep triangels
Azure SDK 2.9 diagnostics exceptions
In Regards to Android On-Screen Keyboard Input
Export Oracle table to New Excel Document
xaml conditional StringFormat
Efficiency of “Eventhandling”
Unable to cancel Async/Awaiting call on button click

Categories

HOME
reactjs
msbuild
stanford-nlp
openacc
ebay-api
arcgis
overrides
ebay
flowtype
meson-build
markdown
handlebars.js
ethereum
google-my-business-api
gcloud
elastalert
suitecrm
ldap-query
ng2-charts
expo
opengrok
appsettings
web-worker
dompdf
css-float
simd
novacode-docx
draw2d
bug-reporting
gnu-screen
apdu
android-xml
knapsack-problem
traveling-salesman
cqlsh
opencsv
wordpress-rest-api
choco
ilog
motherboard
nscollectionview
ninja-forms
electron-packager
rexx
taiga
smooth-streaming
result
django-cors-headers
weld
confluent
e4
r-commander
robotc
scanf
recursive-query
google-scholar
gevent
rowname
instaparse
normalisation
bytearray
angular-i18n
paypal-subscriptions
oryx
jersey-test-framework
videoview
android-contentresolver
properties-file
borland-c++
dcg
vensim
log-analysis
gmaps4jsf
chrome-mobile
fiware-health
random-access
kss
xpand
rssi
new-operator
lastinsertid
grape-api
violation
wpa
pyxplot
leap-year
kademlia
qmainwindow
big-endian
android-memory
code-organization
session-hijacking
jquery-click-event
excellibrary
nstoolbar
pitch-shifting
file-storage
office-2003
moores-law
tracd

Resources

Encrypt Message