Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML in ASP.Net

Status
Not open for further replies.

Stunner01225

Technical User
Mar 13, 2002
150
GB
Hi,
I have taken great time to create a Stored Procedure in SQL server 2000 that returns the data as XML. When I write the XML out however it is being encapsulated with <Table> and <XML_some Hex stuff> tags. What am I doing wrong?

I am new to both XML and asp/ado.net

Thanks for any help
 
How are you writing the XML out and to where? What format are you using in SQL to return your query as XML? Both of these will effect what is happening here. If you coudl provide sample XML and output it would be easier to help too.

Rob

Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Eisenhower 1953
 
The XML is coming from SQL server 2K stored procedure using for XML explicit. It was hard work but I have got it working.
I am new to asp/ado.net and how it handles XML so I am trying everything and anything. I need to create an XSL later on so at the moment I am pushing the XML out into a file at C:\ to see how it looks.
 
I have managed to get an XML reader to work but it is only returning the first record. what am I doing wrong?
 
The reader will only iterate over one node at a time (you'd have to call the .Read() function repeatedly to move forward).

It sounds like what you may be looking for is an XmlDocument which loads all of the XML into an in-memory structure which you can then traverse and manipulate in any direction (even using XPath).

You'd do something like this:

string strXml = //xml returned from DB ;

XmlDocument xd = new XmlDocument();

xd.LoadXml( strXml ); //document now loaded

You can also, for example, load a DataSet or something using the .ReadXml() method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top