How to laod this file?

G

Guest

System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();
System.Xml.XmlTextReader read = new System.Xml.XmlTextReader("url");
xdoc.Load(read);
 
E

Elroyskimms

Why the requirement for the DOM Document? .Net has some pretty
extensive support for XML without using DOM (I could be wrong... but I
use XML extensively in .Net and have never used a DOM document). If you
give some details as to the application, I'm sure I could help you.

-E
 
S

Shapper

Hi Elroy,

In fact I was using the DOM document. I am not sure if this is the best
way.

I have a XML file with RSS news. The function Build_RSS() must load the
XML data and display it in a ASP:Repeater in my HTML code as follows:

1. Channel/Title and Channel/Url values should be used as values in the
two ASP:Labels placed on HeaderTemplate of my ASP:Repeater. Something
like:

label_name.title = [ Channel Title from XML ]
label_name.url = [ Channel URL from XML ]

2. The items data should be used to create a dataset which is then bind
to my repeater and displayed in ItemTemplate. Something like:

If Session("Culture") = "pt-PT" Then
Dataset = [ All item values taken from [pt-PT] ] ...
Else If Session("Culture") = "en-GB" Then
Dataset = [ All item values taken from [pt-PT] ] ...
End

Then all I would need is to do the binding.

My XML file is as follows:

<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>...</title>
<url>...</url>
<item>
<pt-PT>
<title>...</title>
<description>...</description>
</pt-PT>
<en-GB>
<title>...</title>
<description>...</description>
</en-GB>
</item>
<item>
<pt-PT>
<title>...</title>
<description>...</description>
</pt-PT>
<en-GB>
<title>...</title>
<description>...</description>
</en-GB>
</item>
...
</channel>
</rss>

What do you sugest to create this?

And what are the disadvantages of using DOM?

Thank You,
Miguel
 
E

Elroyskimms

Forgive my stupidity, a DOM doc is the way to go.

When you say XML "file" is it an actual text file on the hard drive or
a string already containing XML text? Or is it an incoming stream that
is being sent to your system (via HTTP POST or some other method)?

-E
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top