עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

c# working with xml צריך עזרה :/

Featured Replies

פורסם

טוב אז יש לי את

http://lsirwww.epfl.ch/courses/cis/2005ss/exercises/1/bank.xml

אני מצליח להעביר אותו לאוביקת של xmldocument

ועכשיו אני צריך

" your final task is to loop through its nodes and write out for each node, the name, the value and attributes (if exists).

"

ואני ממש לא יודע אך לעשות את זה

כל החיפושים שלי ב google נותנים דוגמאות של root+child

וכאן יש לי bank/accounts/savings_accounts

צריך עזרה אך עושים את זה??


XmlDocument newdoc = new XmlDocument();
WebRequest request = WebRequest.Create("[url]http://lsirwww.epfl.ch/courses/cis/2005ss/exercises/1/bank.xml"[/url]);
request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine(response.StatusDescription);
Stream dataStream = response.GetResponseStream();
newdoc.Load(dataStream);
XmlElement root = newdoc.DocumentElement;
XmlNodeList nodes = root.SelectNodes("/bank");
foreach (XmlNode node in nodes)
{
string name = root.GetAttribute("customer_account c_id");

string name2 = node["customer_account c_id"].InnerText;
string title = node["savings_accounts"].InnerText;
// Do whatever you want
Console.Write(name);
}

פורסם
  • מחבר

תודה

האמת שעברתי על הלימוד של xml באתר הזה לפני כמה ימים

אבל לא ניכנסתי ל xpath

:)

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.