xmlreader presenting all data on screen vb.net, asp.net

Hi All,

I have been tasked with obtianing information from an xml dataset this morning and presenting all of the information from the XML data on the page.

I have only ever looked for a specific line within an xml file before so feel a little out of my depth and have no real idea how i need to do this.

The nods that I need to obtain information from are as below.

- <item cat1="Beet Intake" cat2="Fluming" cat3="" cat4="">
  <id>11602DB142D59C068025791F004E6459</id>
  <masterid />
  <parentid />
  <author>Critchlow John</author>
  <shift>Mornings</shift>
  <actualday>05/10/2011</actualday>
  <None />
  <None />
  <None />
- <content>
- <![CDATA[ <p> lost of text here....</p>
  </content>
  </item>

my task is to get them into an aspx page that will display the data without issue.

It also looks like the  within the <content> node has all sorts of html tags in them and wonder if these tags will show when presenting the information.

Also if anyone can show me how to use a repeater to show all records I would be very grateful.

Any and all help will be very much appreciated.
SimonPrice33Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
You could do something like this in your markup:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="_27380966._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="XmlDataSource1">
            <ItemTemplate>
                <div>
                    ID:
                    <asp:Label ID="Label1" runat="server" Text='<%# XPath("id") %>' />
                </div>
                <div>
                    Author:
                    <asp:Label ID="Label2" runat="server" Text='<%# XPath("author") %>' />
                </div>
                <div>
                    Shirt:
                    <asp:Label ID="Label3" runat="server" Text='<%# XPath("shift") %>' />
                </div>
                <div>
                    Actual Day:
                    <asp:Label ID="Label4" runat="server" Text='<%# XPath("actualday") %>' />
                </div>
                <div>
                    Content:
                    <asp:Label ID="Label5" runat="server" Text='<%# HttpUtility.HtmlEncode(XPath("content")) %>' />
                </div>
            </ItemTemplate>
        </asp:Repeater>
        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="input.xml" XPath="//item" />
    </div>
    </form>
</body>
</html>

Open in new window


As for the "content" node, do you want the HTML to be processed as HTML, or displayed as raw text? I believe by default it will be rendered, but if you want it to be raw text, you could change line 31 to:

<asp:Label ID="Label5" runat="server" Text='<%# HttpUtility.HtmlEncode(XPath("content")) %>' />

Open in new window

0
SimonPrice33Author Commented:
HI Kaufmed,

Thanks for this, the data comes through but with all the HTML tags within the text in the same way its been entered into the XML from a Lotus Notes Domino Agent. Which I have no access or control over.

Any thoughts on how I could get around this?
0
käµfm³d 👽Commented:
Thanks for this, the data comes through but with all the HTML tags within the text in the same way its been entered into the XML from a Lotus Notes Domino Agent. Which I have no access or control over.
Ok, but do you want to display the embedded HTML as HTML, or as raw text?
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

SimonPrice33Author Commented:
I would like to display it as HTML if possible.
0
käµfm³d 👽Commented:
Then the original code snippet ( http:#codeSnippet20-36916563-1 ) should work--at least it appeared to in my testing. Are you experiencing otherwise?
0
SimonPrice33Author Commented:
below is the output of what we see on screen.

<P><STRONG>Slicers :-</STRONG> Knife blocks changed in No's 1 &amp; 3</P> <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; No 1 cossttte belt stopped / started for removal / fitting of spray bar by engs.</P> <P><STRONG>Gp's :-</STRONG> No's 1 / 2 &amp; 3 pressure washed.</P> <P><STRONG>Clarifier :-</STRONG> Ratios dropped 0.02 / 0.01 &amp; 0.02 from top to&nbsp;bottom respectively.</P> <P><STRONG>Dlp's :-</STRONG> G &amp;&nbsp;G ( Gerry &amp;&nbsp;Graham ) working on&nbsp;presses.</P> <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fill volumes dropped to 7.5m3.</P> <P><STRONG>Heaters :-</STRONG> No 6 raw&nbsp; juice htr available.</P> <P><STRONG>Towers :-</STRONG> Draft ratios dropped 0.01 &amp; 0.02 to 1.22 &amp; 1.05 respectively.</P> <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Formaldehyde timers dropped x 2 secs to 13 &amp; 3 secs.</P> <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Acid strength measured at 3.3%.</P> <P><STRONG>Pulp Presses :-</STRONG> Sequence taken off initially by No 9 pressed&nbsp;scroll, then had fleeting low oil pressure across all press oil p/p's taking presses off.</P> <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Timed out &amp; presses / seq re-started only for no 8 pressed scroll to take us off, elecs in attendance then seq re-started once again.</P> <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; No 1 press slide shut &amp; run empty, then stopped for welders to repair as screen gone again.</P>
0
SimonPrice33Author Commented:
although th ecode in teh snippet looks to be the same as that in the previous example.
0
käµfm³d 👽Commented:
That's my fault. I copied an updated version to that snippet. In the original code, change line 31 from:

<asp:Label ID="Label5" runat="server" Text='<%# HttpUtility.HtmlEncode(XPath("content")) %>' />

Open in new window


to:

<asp:Label ID="Label5" runat="server" Text='<%# XPath("content") %>' />

Open in new window



although th ecode in teh snippet looks to be the same as that in the previous example.
That's because it is the same code! I linked to the snippet so would go to the exact code I was referring to when you clicked it  = )
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SimonPrice33Author Commented:
thanks
0
käµfm³d 👽Commented:
NP, glad to help. Sorry for the bungle on the initial post  = )
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.