473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Xpath and treeview to load part of xml file?

1
Hi,
I have the following xml sample file:
<?xml version="1.0" encoding="utf-8"?>
<catalogue id="catalogue">
<alldocs id="alldocs">
<documents id="New Heading1" desc="" link="#" uid="1">
<document id="New Document6" desc="" link="#" keywords="" uid="6" />
<documents id="New Heading9" desc="" link="#" uid="9">
<document id="New Document12" desc="" link="#" keywords="" uid="12" />
<document id="New Document14" desc="" link="#" keywords="" uid="14" />
</documents>
<documents id="New Heading10" desc="" link="#" uid="10" />
<document id="New Document11" desc="" link="#" keywords="" uid="11" />
</documents>
</alldocs>
</catalogue>
I want to bind part of this xml file to a treeview control, lets say only the <documents> node with uid=”9” and its subnodes. I have tried the following, but nothing is returned
I have a xmldatasource control, and a treeview control on my aspx page, and in the code behind file the following:
xmlds.DataFile = “~/myxml.xml”
xmlds.XPath = "*[@uid='9']"
xmlds.DataBind()

trvList.DataSource = xmlds
trvList.DataBind()
trvList.AutoGenerateDataBindings = True

Any help will be appreciated.
Jan 29 '08 #1
0 1119

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Vibor | last post by:
Hello, I have XML file that looks likes this: <?xml version="1.0" encoding="utf-8" ?> <prezentacije> <datoteka naziv="Koherentni valovi"...
0
by: DKode | last post by:
Ok, I am creating a directory browsing app and am using the obout.com TreeView control. This is exactly what I was looking for, as of right now my code is quite sloppy and I plan on cleaning it...
10
by: Michael C# | last post by:
OK, here's the deal. I have a small XML file that represents a small database table. I load it into a System.XML.XMLDocument. So far so good. I run an XPath query against it to retrieve all the...
2
by: janhm | last post by:
Hey, I had a problem with adding xml into a treeview few month ago. The project got abandon, but im now working with it again. Here is my problem: I have an xml file containing: <?xml...
8
by: Joe Pannone | last post by:
Does anyone have an example on using an XPath statement (in VB.NET) where the source XML document is NOT a file, but a 'text' value from SQL Server?
2
by: Riki | last post by:
I'm stuck with an XPath query to produce a TreeView. From the data below, I want to select all the score elements having an IdIn of 2018, ***including their ancestors***. With the result, I want...
3
by: Jason Mobarak | last post by:
Hello -- I'm attempting to get a handle on how to do xpath queries with System.Xml -- so far the biggest hurdle has been how to deal with a default namespace. If I use the test xml: <?xml...
6
by: Derek Hart | last post by:
I bring in an xml file into vb.net by using xmlDoc.LoadXml(XMLString) - I run xpath statements against the xml file to grab data from it, so I use, as an example, //Vehicles/Vehicles/@make to get...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.