473,385 Members | 1,764 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.

ML with attributes NOT working with Datase

I am trying to display the "DESCRIPTION" node in a DataGrid control from an
xml file.

It works fine, as long as the root node does NOT have any attributes, i.e. a
count of the number of nodes returned.

However almost all of our xml documents have attributes inside the root
node, so reformatting the xml documents isn't an option.

I've shown below my code, really simple, nothing fancy. This code will
work, however if you change <Groups> to <Groups RECORD_COUNT="2"> then the
program will fall over at the DataGrid1.DataBind line with the exception
message of "A field or property with the name 'DESCRIPTION' was not found on
the selected datasource. "
Does anyone know how to solve this without having to do any XSLT or other
language?

Keith.

--- CODE ---

-- default.aspx --

<asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="DESCRIPTION"></asp:BoundColumn>
</Columns>
</asp:DataGrid>

-- default.aspx.vb --
Dim dsProducts As New DataSet

dsProducts.ReadXml(Server.MapPath("xTest.xml"))

DataGrid1.DataSource = dsProducts

DataGrid1.DataBind()

---XML FILE---

<?xml version="1.0" encoding="UTF-8"?>

<!-- <Groups RECORD_COUNT="2"> -->

<Groups>

<GROUP>

<CODE>1234</CODE>

<DESCRIPTION>First Code Description</DESCRIPTION>

<GROUP_RECNUM>4321</GROUP_RECNUM>

</GROUP>

<GROUP>

<CODE>5678</CODE>

<DESCRIPTION>Second Code Description</DESCRIPTION>

<GROUP_RECNUM>8765</GROUP_RECNUM>

</GROUP>
</Groups>

Nov 11 '05 #1
0 1325

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

Similar topics

6
by: beliavsky | last post by:
I have started using classes with Python and have a question about their use. In Python, 'attributes are all "public" and "virtual" in C++ terms; they're all accessible everywhere and all looked...
1
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
3
by: Stephan Brunner | last post by:
Hi I have created two flavors of an XSLT stylesheet to transform all attributes of an XML document to elements: They both work as expected with MSXML and XMLSPY but throw an exception ...
16
by: Bret Pehrson | last post by:
I've converted a non-trivial C++ library to managed, and get the following unhelpful linker error: Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom attributes are...
11
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
5
by: Kimmo Laine | last post by:
Hi is there a way to change propertys attribute from the code? Letīs say that i have the following property in my class: public int Count } Is there a way to change the displayname, from...
3
by: cristalink | last post by:
Hi, I have a C++/CLI DLL which I marked with in a cpp file. Is there a standard tool from Microsoft that takes a .DLL file and displays all the .NET attributes of the assembly? Thanks, ...
2
by: rds80 | last post by:
In the xml document below, I would like to retrieve the distinct attributes for the element '<Bal>'. However, I haven't had any success. Here is what I have so far: <TRANS> <TRAN...
11
by: Rafe | last post by:
Hi, I'm working within an application (making a lot of wrappers), but the application is not case sensitive. For example, Typing obj.name, obj.Name, or even object.naMe is all fine (as far as...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.