TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kalu singh rao
288
6.4k
109.3k
How to use for each loop for xml
Sep 27 2014 3:04 AM
I want to get string xml attributes value in object. But i have multiple data node in string xml then i want to use for each loop for get value of node.But i am little confusing how and where can i use for each loop in following code.
ProcessVals = <PassScroll>
<Pass LedgerName="SB FORMS" SerialFrom="1" SerialTo="100" Qty="10" Rate="10.000000" IssuedQty="10" />
<Pass LedgerName="CD FORMS" SerialFrom="1" SerialTo="2500" Qty="50" Rate="15.000000" IssuedQty="10" />
</PassScroll>
Dim root As XElement = XElement.Parse(ProcessVals)
Dim child = root.Element("Pass")
For Each rt As XElement In child
Dim passScroll As PassScroll = New PassScroll
Dim pass As New Pass
pass.LedgerName = child.Attribute("LedgerName").Value
pass.SerialFrom = Convert.ToInt32(child.Attribute("SerialFrom").Value)
pass.SerialTo = Convert.ToInt32(child.Attribute("SerialTo").Value)
pass.Qty = Convert.ToInt32(child.Attribute("Qty").Value)
pass.Rate = Convert.ToDouble(child.Attribute("Rate").Value)
pass.IssuedQty = Convert.ToInt32(child.Attribute("IssuedQty").Value)
passScroll.Pass = pass
Next
Any help will appreciate. Thank you in advance.
Reply
Answers (
0
)
How to Control Reverse feeding a Epson Printer in C#.
Find values between two ' " " ' strings