473,545 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beginners-problem with xpath filter and XML

Hello all,
I am building a personal web site in VS2005 as a kind of learing
project for myself, so forgive me if this is a novice question.

I am planning to use an XML file called SiteSettings.xm l to hold
site-wide info such as copyright info, site title (e.g. my homepage)
etc. Currently this xml file looks like this:

<?xml version="1.0"?>
<SiteSettings >
<Settings Name="TitleText ">
<value>My homepage</value>
</Settings>
</SiteSettings>

U use a datalist and a xmldatasource to display the data. The
xmldatasource lets me supply an xpath filter to display only the data I
want. As Im planning to expand this xml-file as I add more site
settings, I need an xpath that displays only the correct data. I am
trying to build an xpath that simply returns "My homepage" without the
node name or anything, but I am having a hard time making it work -
either it includes the "value" or simply doesn't show up at all..

If anybody has any inputs to either how to construct my Xpath or maybe
if I should go with another XML structure, I would gratly appreciate
it.

Trond Hindenes
Novice vb.net programmer
Norway

Nov 12 '05 #1
2 2289
Hello!
<?xml version="1.0"?>
<SiteSettings >
<Settings Name="TitleText ">
<value>My homepage</value>
</Settings>
</SiteSettings>

U use a datalist and a xmldatasource to display the data. The
xmldatasource lets me supply an xpath filter to display only the data I
want. As Im planning to expand this xml-file as I add more site
settings, I need an xpath that displays only the correct data. I am
trying to build an xpath that simply returns "My homepage" without the
node name or anything, but I am having a hard time making it work -
either it includes the "value" or simply doesn't show up at all..


Try this:

/SiteSettings/Settings[@Name = 'TitleText']/value/text()
--
Pascal Schmitt
Nov 12 '05 #2
Works like a charm, thanks a lot!!

BTW, when looking at my code, I see that vistual studio adds the text
"Value:" before the actual content in the xpath query, so i wasn't way
off :-)

thanks again,

best regerds,
Trond Hindenes
Norway

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2825
by: P.Hill | last post by:
I was just trying to install Apache and php on an XP box for test of a PHP website I built last year. It was my first and only, so I am now rusty about the little I did learn last year. I get the following error in my log after I think I have I configured apache and php " C:/Websites/matrixcsbsju/html.test/matrix.htaccess: Invalid...
0
1588
by: Jeff Wagner | last post by:
I found an excellent tutorial at the following location. I found it very helpful and a good refresher for some things I had forgottent ... thought I'd share this with other beginners. http://www.devshed.com/Server_Side/Python It's called Python 101 and it's in 8 parts. Enjoy, Jeff
7
1918
by: Will | last post by:
Pardon two post in a row to the newsgroup but I want to try and expedite this, if you guys don't mind helping out... I running Windows XP Pro and wanted to download Python and any additional tools I should consider using as I get going... 1 - Python-2.3.3.exe from www.Python.org 2 - win32all, a collection of Windows-specific extensions...
38
4766
by: BORT | last post by:
Please forgive me if this is TOO newbie-ish. I am toying with the idea of teaching my ten year old a little about programming. I started my search with something like "best FREE programming language for kids." After MUCH clicking and high-level scanning, I am looking at Python and Forth. Both have advocates that say each is a great...
4
2288
by: blah | last post by:
I m actually a Novice in Python as well as Linux, When i look up things on the internet about Linux Flavours, They are written so complex that it is difficult for me to understand, i am asking if anyone here know of a Linux Distribution that is for beginners (I am a new user of linux, therefore, i dont know what linux will do.) also the...
4
2228
by: Eggnog | last post by:
Hi, Is there a newsgroups for beginners questions? Cheers, Nawg
6
4053
by: William Foster | last post by:
Does anyone know of a good online tutorial for C# focused on beginners. I have been to many great sites like csharpfriends, csharp-corner etc looking for good tutorials and have had no luck. Any advice would be appreciated. Bill Foster
4
2112
by: aman firoz | last post by:
do you people got anything for c beginners..... help me out guys
0
1430
by: Dual_b00t | last post by:
hi i created a site called PHP Together its for beginners also for gurus to help out the beginners if you are learning PHP and feel alone then drop by . ciao Mark
19
4075
by: yltkhuu | last post by:
1. How does having a widely adopted C++ standard help game programmers? 2. What are the advantages ans disadvantages of employing the "using" directive? 3. Why might you define a new name for an existing type? 4. Why are there two versions of the increment operator? What's the difference between them? 5. How can you use constants to improve...
0
7409
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7918
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7766
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1897
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1022
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.