G
Guest
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
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).AttributeName)
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>
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
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).AttributeName)
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>