Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reading XML into dataset and keeping line break from XML

Posted on 2007-12-01
4
Medium Priority
?
953 Views
Last Modified: 2012-06-27
I am reading information from a XML file into a Dataset and loading it to a webpage.  I wanted to keep the format from the XML file such as line break (see code example).  I loaded the xml to dataset as ds.ReadXml(filename) and loaded it do a table.  How can i make line break from text in <blog> in XML file appear in webpage??

<Comments>
    <Name>VAldimf</Name>
    <Time>01.12.2007 12:14:43</Time>
    <Title>slasfdj</Title>
    <Blog>valdij
södfj
 
 
 
asdföj
adsfj
 
asdföj
sadf</Blog>
    <ID>4</ID>
  </Comments>
 
 
...
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                TableRow tr = new TableRow();
                tr.Cells.Add(new TableCell());
...
                tr.Cells[0].Text = "<FONT size = 2 FACE = Verdana color = #8F8672 >" + dr[3].ToString() + "</FONT>";
                this.BlogTable.Rows.Add(tr);
.....

Open in new window

0
Comment
Question by:va80
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 40

Expert Comment

by:evilrix
ID: 20387943
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 600 total points
ID: 20387951
Use :
tr.Cells[0].Text = "<FONT size = 2 FACE = Verdana color = #8F8672 >" + dr[3].ToString().Replace("\n","<br>") + "</FONT>";
               
Replace real newlines with the <br> tag.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20387953
http://msdn2.microsoft.com/en-us/library/ms256097.aspx

So, try this: -


Comments>
    <Name>VAldimf</Name>
    <Time>01.12.2007 12:14:43</Time>
    <Title>slasfdj</Title>
    <Blog xml:space="preserve">valdij
södfj
 
 
 
asdföj
adsfj
 
asdföj
sadf</Blog>
    <ID>4</ID>
  </Comments>

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question