473,569 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URGENT: Formatting ADO style XML


I am writing a windows form that will query the database.

string query = "SELECT TOP 2 * FROM Northwind.dbo.C ustomers" ;
DBQuery Q = new DBQuery() ;
bool result = dbCommander.Run Query(query, true, ref Q) ;

stream = new MemoryStream(Q. DataAsByteArray , false) ;
stream.Position = 0;
XmlTextReader xmlReader = new XmlTextReader(s tream);

DataSet ds = new DataSet();
ds.ReadXml( xmlReader );

// does not give me anything...
Debug.WriteLine ( ds.GetXml() );

xmlReader.Close () ;
Here is typically ADO style XML stream I recieve from the queries I send to
the database:

<xml version="1.0" encoding="UTF-16">
<xml xmlns:s="uuid:B DC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid: C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:s chemas-microsoft-com:rowset" xmlns:z="#Rowse tSchema">
<s:Schema id="RowsetSchem a">
<s:ElementTyp e name="row" content="eltOnl y"
rs:CommandTimeo ut="30">
<s:AttributeTyp e name="CustomerI D" rs:number="1"
rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="5 "
rs:fixedlength= "true" rs:maybenull="f alse" />
</s:AttributeType >
<s:AttributeTyp e name="CompanyNa me" rs:number="2"
rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="4 0"
rs:maybenull="f alse" />
</s:AttributeType >
<s:AttributeTyp e name="ContactNa me" rs:number="3"
rs:nullable="tr ue" rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="3 0" />
</s:AttributeType >
<s:AttributeTyp e name="ContactTi tle" rs:number="4"
rs:nullable="tr ue" rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="3 0" />
</s:AttributeType >
<s:AttributeTyp e name="Address" rs:number="5"
rs:nullable="tr ue" rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="6 0" />
</s:AttributeType >
<s:AttributeTyp e name="City" rs:number="6"
rs:nullable="tr ue" rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="1 5" />
</s:AttributeType >
<s:AttributeTyp e name="Region" rs:number="7"
rs:nullable="tr ue" rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="1 5" />
</s:AttributeType >
<s:AttributeTyp e name="PostalCod e" rs:number="8"
rs:nullable="tr ue" rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="1 0" />
</s:AttributeType >
<s:AttributeTyp e name="Country" rs:number="9"
rs:nullable="tr ue" rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="1 5" />
</s:AttributeType >
<s:AttributeTyp e name="Phone" rs:number="10"
rs:nullable="tr ue" rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="2 4" />
</s:AttributeType >
<s:AttributeTyp e name="Fax" rs:number="11"
rs:nullable="tr ue" rs:writeunknown ="true">
<s:datatype dt:type="string " dt:maxLength="2 4" />
</s:AttributeType >
<s:extends type="rs:rowbas e" />
<z:row CustomerID="ALF KI" CompanyName="Al freds Futterkiste"
ContactName="Ma ria Anders"
ContactTitle="S ales Representative" Address="Obere Str. 57"
City="Berlin" PostalCode="122 09"
Country="German y" Phone="030-0074321" Fax="030-0076545" />
<z:row CustomerID="ANA TR" CompanyName="An a Trujillo Emparedados
y helados" ContactName="An a Trujillo"
ContactTitle="O wner" Address="Avda. de la Constitución 2222"
City="México D.F." PostalCode="050 21"
Country="Mexico " Phone="(5) 555-4729" Fax="(5) 555-3745" />

I know I could use the XmlDocument but what I would like to achieve is
getting the DataSet table mapping of several tables which I do not think I
could achieve with XmlDocument (unless I am wrong)... As far as I personally
think I do not think the DataSet can handle this form of XML. I think I will
need to first parse it to a more likeable XML format the DataSet will be able
to recognize.

How could I parse the XML above to something a more common XML format?


Nov 12 '05 #1
1 1335
"Yama" <Ya**@discussio ns.microsoft.co m> wrote in message news:6A******** *************** ***********@mic rosoft.com...
<xml version="1.0" encoding="UTF-16">
<xml xmlns:s="uuid:B DC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid: C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:s chemas-microsoft-com:rowset" xmlns:z="#Rowse tSchema"> : : As far as I personally think I do not think the DataSet can handle
this form of XML.
Not directly, no.
How could I parse the XML above to something a more
common XML format?

You could write an XSLT stylesheet; or a custom XmlReader.

It's probably easier to load this legacy XML into an ADO Recordset
(using Interop) which understands it, and then use the SQLOLEDB
provider to import it into an ADO.NET DataSet as described in this
excellent knowledge base article,

Derek Harmon
Nov 12 '05 #2

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

Similar topics

by: Dan Weeb | last post by:
Hi All, I have struggled through this far with help from many of you so thanks. I am stuck again. I am really new to this so don't be harsh :-) There are a few problems. You can run the script here http://www.pbrown.com/research/test1.php to see the formatting issues Formatting Issues
by: dinoo | last post by:
I need your help I want to know what other options user have if he does not have Microsoft Word on his machine I would like to use word sort of application for formatting documents, these application should be freely available or redistributable Are there other software application which can be automate for text formatting using .NET I...
by: Kevin G. | last post by:
I'm not sure if this is possible, but if a page uses a CSS style sheet and you would still like to use good old <font> tags... is there a tag to tell the browser to ignore the CSS formatting just for that table cell? I work for a company that has their website built from a 3rd party. We're very restricted in how we can redesign the pages. ...
by: John Mason | last post by:
Hi, I have a Datagrid control with an edit command column, which has a PushButton ButtonType. I am trying to apply formatting to the plain grey button, to make it look more appealing on screen. I would like to change the font-size and the set the background color, the foreground color of the text, and also set a border color and width.
by: Coleen | last post by:
Hi all :-) I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML. Here is the snippet of code for the cell I'm trying to format: Dim ld_tot_pet_clean_fee_calc As Double ld_tot_pet_clean_fee_calc = li_net_total_calc * 0.0075 ld_tot_pet_clean_fee = lo_misc_func.FormatMC(ld_tot_pet_clean_fee_calc,...
by: Arthur Dent | last post by:
Hello all, ive been programming with ASP.NET since it came out, but am just getting my feet with now with v.2. Ive noticed something strange in the way my HTML tables get rendered with 2. I use tables to layout my pages, doing three rows, a header, content and footer. When i do this, i make the tables height=100%, so the footer always shows...
by: mdh | last post by:
Hi Group, Not looking for an answer, but more of an explanation. Thinking back to those heady days when you had the time to do them, may I ask this. Exercise 1-22 asks for a program to "fold" long input lines into 2 or more shorter lines before the nth column... etc etc. Now, there are numerous anwers on the web and in the "C answer...
by: mrid via DotNetMonster.com | last post by:
hi. im exporting data from a vb form to excel. i am able to create a new excel file, save and edit it without any trouble, but the formatting is giving me hell! i need to be able to show certain cells in bold, with underlining etc. i dont understand how, but in the following code, the instruction for bold gets picked up for all the cells (even...
by: Josiwe | last post by:
I have a search program that returns an HTML string which I display to the user. I want to highlight the search terms. However a simple search and replace on the HTML causes problems. If the user searches on Georgia and I get back this: <div style="font-name:Arial">Georgia, Alabama, and Louisiana</div> It works fine: <div...
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
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...
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. ...
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...
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...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.