473,394 Members | 1,831 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,394 software developers and data experts.

Retrieve attributes from xml document using typed dataset

I have an XML document that stores configuration settings for an app. I
generated the schema using vs.net and also the corresponding dataset. I can
load the config file (config.xml - below) and get all the data except for the
element attribute values. I cannot figure out why the attribute values return
a value of system.dbnull when the file contains values for those attributes.
The code is as follows:

config loader .vb
'Config is a strongly typed dataset
Dim dsConfiguration As New Config
dsConfiguration.ReadXml(Server.MapPath("Config.xml "))
'I cannot get the following attribute value title
Response.Write(dsConfiguration.Page(0).Title)
'but this works fine
Response.Write(dsConfiguration.JavaAttribute(0).At tributeName)
config.xml
<?xml version="1.0" encoding="utf-8" ?>
<Config xmlns="http://tempuri.org/Config.xsd">
<Page Title="Some title">
<MetaTag>
<Attribute AttributeName="something" Value="skdj" />
</MetaTag>
<JavaScript Path="/script.js">
<JavaAttribute>
<AttributeName>language</AttributeName>
<Value>JavaScript</Value>
</JavaAttribute>
</JavaScript>
<StyleSheet Path="/style.css">
<StyleAttribute>
<AttributeName>rel</AttributeName>
<Value>stylesheet</Value>
</StyleAttribute>
<StyleAttribute>
<AttributeName>type</AttributeName>
<Value>text/css</Value>
</StyleAttribute>
</StyleSheet>
</Page>
</Config>

Nov 12 '05 #1
0 1162

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

Similar topics

5
by: DraguVaso | last post by:
Hi, Something I don't understand about a Typed DataSet: When a value in the DataSet is DBNull, it throws this error: "Cannot get value because it is DBNull". But aren't Typed DataSets...
1
by: Eugfene | last post by:
I have the following function in a html file: function selectEdit(fileID, processCode, processID, fileName,fileDesc) { document.forms.recordID.value = fileID; document.forms.processor.value =...
1
by: Dave | last post by:
Hi all, I've seen that many people have had this exact same problem in the past, but no-one seems to post the answer when (if) they solve it... so here we go again. If I create a strongly...
3
by: David Elliott | last post by:
I wrote an application to scrape a database and create an XSD file which will be annotated by a map file in order to create a Typed DataSet. I was wondering if I could do the annotation using...
0
by: Bill | last post by:
I have a strong typed dataset which I load using the following code. try { XmlTextReader xmlTR = new XmlTextReader("XIF-v1.0.xsd"); dsMyDataSet.ReadXmlSchema(xmlTR); if (p_FileName !=...
2
by: Thomas | last post by:
Hi, I used xsd.exe to generate a *.xsd file from the *.xml-File and then I created a typed DataSet in VisualStudio 2003 But now I have problems to read the data from the DataSet. <?xml...
1
by: Lerp | last post by:
Hi all, I have a question regarding the best way to build a dynamic XML document from data stored in my database. From what I have read so far, I could build a dataset and then use this...
1
by: Linda | last post by:
Hi, I'm new to asp.net and tryign to learn how to work with data grids. I'm retrieving data from a stored procedure and putting it in a data grid. I then want to be able to sort the data when...
4
by: sherifffruitfly | last post by:
Hi, I have an xml file with structured like this: <?xml version="1.0" encoding="UTF-8"?> <Soldiers> <Soldier name="Billy Smith" rank="Private" serial="34" /> (a bunch more soldiers)
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.