Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to save a recordset as XML without the namespace attributes?

Reply
Thread Tools

How to save a recordset as XML without the namespace attributes?

 
 
ferd
Guest
Posts: n/a
 
      01-11-2006
Hello,

I want to query an access database in ASP (classic) and save the
results as an XML file that I can use as a Data Island in Internet
Explorer - I have the recordset, I can save it as XML, but there's a
bunch of junk at the beginning of the file that makes the IE data
island mechanism not work.

here's what I do:
dim objXML
Set objXML = Server.CreateObject("MSXML2.DOMDocument")

'LOAD DATA
'dim objRS : set objRS = m_Connection.Execute(m_sSQL)

'TRANSFER DATA FROM RS TO XML
With rsClass
Call .Save(objXML, 1) '1 - indicates to save Recordset as XML
Call .Close()
End With
objXML.save( "D:\InetPub\wwwroot\testarea\critiqueformdata.xml" )


the resulting XML starts off with

<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">

lotsa attributes followed by <s:Schema ...

lotsa stuff I either don't need or cause IE not to process it
correctly.

However when doing XML data inline in the HTML with Internet Explorer
it DOES work with a simpler xml file like this:

<?xml version="1.0" encoding="UTF-8"?>
<dataroot>
<CritiqueFormData>
<ModuleName>My Module</ModuleName>
<date>30 January</date>
<Active>0</Active>
</CritiqueFormData>
<CritiqueFormData>
<ModuleName>My Second Module</ModuleName>

etc...


any ideas how I can either omit the attirbutes and schema descriptor
information in the ASP export (or the MS Access export, for that
matter) ....

OR

to get IE to properly loop through this data when I have a table
declaration like this:

<table datasrc="#critiqueformdata" width="700px" border="1">
<tr>
<td><span id="coursetitle" datasrc="#critiqueformdata"
datafld="ModuleName"></span></td>


etc....


THANKS in advance!

ferd

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-11-2006
ferd wrote:
> Hello,
>
> I want to query an access database in ASP (classic) and save the
> results as an XML file that I can use as a Data Island in Internet
> Explorer - I have the recordset, I can save it as XML, but there's a
> bunch of junk at the beginning of the file that makes the IE data
> island mechanism not work.
>


See http://www.davidpenton.com/testsite/...ta.islands.asp
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
 
ferd
Guest
Posts: n/a
 
      01-12-2006
Thanks for the response. I couldn't get the code to work for me,
probably becase of the first line - the include:

<!--#include virtual="/testsite/global_include.asp" --> (couldn't find
that fiile)


but I think I get the gist of it - write yer own - in order to not have
the extra attributes or schema information, e.g


<?xml version="1.0" encoding="UTF-8"?>
<data>
<row>
<field1>blah blah</field1>
</row>
</data>

and not

<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<s:Schema id="RowsetSchema">
<s:ElementType name="row" content="eltOnly" rs:updatable="true">

etc...


..... I need to write my own exporter in asp. Seems odd that even in
MS Word it is possible to choose "Data Only" and export simple, clean
XML. I was hoping that Access or ASP would have the option to do the
same. arrgh.

thanks again
ferd

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-12-2006
ferd wrote:
> Thanks for the response. I couldn't get the code to work for me,
> probably becase of the first line - the include:
>
> <!--#include virtual="/testsite/global_include.asp" --> (couldn't find
> that fiile)
>

That line was added by the guy who posted this code to his site. The include
file contains the database connection info and the functions needed to
display the code on the resulting page sent to the browser.

You will need to supply your own database connection information to enable
this code to work on your own server.

>
> but I think I get the gist of it - write yer own - in order to not
> have the extra attributes or schema information, e.g

<snip>
>
> .... I need to write my own exporter in asp. Seems odd that even in
> MS Word it is possible to choose "Data Only" and export simple, clean
> XML. I was hoping that Access or ASP would have the option to do the
> same. arrgh.
>

That's the difference between the latest version of an end-user interface
(Word 2003) and a programming language/development environment that was in
existence long before xml was even a twinkle in somebody's eye and has not
been updated in a few years ...

Actually, even ADO.Net has no way to do this without the developer
overriding the XMLSerializer class. They assume you want to be able to
deserialize the resulting xml back into the object from which it was
serialized (this is usually the case).

If you're using SQL 2000+, you can use a "FOR XML" clause to get close to
what you want.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
ADO Recordset Save as XML error Kasp XML 0 11-15-2005 02:13 PM
ADO Recordset Save as XML error pierre.saucin@skynet.be XML 0 11-15-2005 01:52 PM
ADO Recordset Save as XML error pierre.saucin@skynet.be XML 0 11-15-2005 01:52 PM
RecordSet.Move or RecordSet.AbsolutePosition?? Hung Huynh ASP General 8 09-24-2003 11:07 AM



Advertisments