0

I'm not good in ASP.NET(c#) and XML. I have a textbox control, a button, and a website url(ex: http://chelseacole.com/question) has content of a xml file, like this:

<paragraph>
<text att1="1" att2="2">
        facebook, facebook, facebook, facebook.
</text>
<text att1="3" att2="4">
        twitter, twitter, twitter, twitter.
</text>
<text att1="5" att2="6">
        facebook, twitter, facebook, twitter.
</text>
</paragraph>

So what I want is: went I click the button, the result will appear in the textbox control, like this:

facebook, facebook, facebook, facebook.
twitter, twitter, twitter, twitter.
facebook, twitter, facebook, twitter.

Anyone gonna help me? Thanks in advance! :">

1
  • Could you post the code you use to populate the textbox. Commented Jul 1, 2011 at 9:16

2 Answers 2

3

If I've understand what do you want to achieve, try something like this:

XDocument document = XDocument.Load("file.xml");

or:

XDocument document = XDocument.Parse("<paragraph><text att ... ");

foreach (XElement item in document.Descendants("text"))
    textbox.Text+=item.Value + Environment.NewLine;
Sign up to request clarification or add additional context in comments.

Comments

1

You could check this

LINQ to read XML

I would not recommend any other solution than this

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.