Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 28th, 2008, 07:59 AM
Registered User
 
Join Date: Apr 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading XML doc into dataset

Hi,

Description of problem:

DataSet dsComp= Created dataset by calling stored procedure


In this dsComp, there is one table called tblContract which has 5 columns out of which one column has null value in every row. The stored proc correctly fetches 5 columns from database and dscomp also shows in tblContract 5 columns.


dsComp is loaded into xmldoc

xmlDocComp.LoadXml(dsComp.GetXml());



Reading that xmldoc, a new dataset dsAnk is made.

XmlNodeReader nodeRdrAnk = new XmlNodeReader(xmlNode);

DataSet dsAnk = new DataSet ();

dsAnk.ReadXml(nodeRdrAnk);



dsAnk shows in tblContract only 4 columns, the column with all null values gets negated.

How to retrieve 5 columns in contract table of dsAnk by reading the XMLDoc
 
Old April 28th, 2008, 08:18 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Have you tried to load the schema of the first data set first e.g.
Code:
dsAnk.ReadXmlSchema(new StringReader(dsComp.GetXmlSchema()));
dsAnk.ReadXml(nodeRdrAnk);
Perhaps that helps to preserve the columns.

--
  Martin Honnen
  Microsoft MVP - XML
 
Old April 28th, 2008, 08:25 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

There's a bad habit on this forum of asking questions that relate to one particular XML technology without saying what technology you are talking about. There was an example last week where we had to guess it was Oracle by recognising the version numbers 9i and 10g. On this one, sorry, I don't recognise it. There are any number of XML libraries containing classes with names like XmlNodeReader. I suspect something to do with .NET, but really I've no idea. If you want answers, you need to explain the problem.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 28th, 2008, 09:37 AM
Registered User
 
Join Date: Apr 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Regret the inconvenience.

This is related to using XML in asp.net 1.1

 
Old April 29th, 2008, 02:37 AM
Registered User
 
Join Date: Apr 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Martin. I am able to retrieve the 5th Column.






Similar Threads
Thread Thread Starter Forum Replies Last Post
reading a html doc into outlook body message matpen Word VBA 5 June 21st, 2009 10:19 PM
Creating XML doc ; writing string(xml format) into KamalRaturi XML 5 May 28th, 2008 05:51 AM
question about reading xml dataset kscase Visual Basic 2005 Basics 2 May 3rd, 2007 01:30 PM
Reading/Amending .doc File Properties turklet ASP.NET 2.0 Basics 1 December 14th, 2006 01:08 PM
Reading .Doc File in ASP.NET 1.0/1.1 [email protected] .NET Framework 1.x 2 September 7th, 2006 12:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.