473,395 Members | 1,761 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,395 software developers and data experts.

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

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

Jan 11 '06 #1
3 3113
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"
Jan 12 '06 #2
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

Jan 12 '06 #3
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.
Jan 12 '06 #4

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

Similar topics

8
by: Adrian Parker | last post by:
Hi. I would like to query a database, given several where clauses to refine my search, and return the value of one single field in the database. eg: I have a table that lists teachers. Their...
25
by: kj | last post by:
Consider the following XML document: <?xml version='1.0' encoding='UTF-8'?> <bar:foo xmlns:bar='someuri'> <baz/> </bar:foo> What namespace does baz belong to? What is this namespace bound...
1
by: DraguVaso | last post by:
Hi, I found some examples for storing the FormSettings of a Form in an XML-file, but none of these could match my criteria: What I am looking for is the possibility to save the FormSettings of...
3
by: Edward Grosso via .NET 247 | last post by:
Hi to all the dotnet community, I'm actually trying to figure out how can I save a Recordset to an ASCII file with custom field separators, in a fast way, without loops. Perhaps there is some way...
6
by: Andy Barber | last post by:
Hi, I'm trying to write an app that reads data from a table into a string variable for later use in my program. Below is a snippet of the code I'm using, which compiles ok, but at runtime I get...
22
by: Br | last post by:
First issue: When using ADPs you no longer have the ability to issue a me.refresh to save the current record on a form (the me.refresh does a requery in an ADP). We usually do this before...
5
by: C Watson | last post by:
Hi, I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a very specific feature that I would like to use it for. I have a rather long form that the users use to enter data...
3
by: matt.skibbs | last post by:
When we moved a project from .NET 1.1 to .NET 2.0, we ran into an issue with some code that inserts a datatable from IDataReader.GetSchemaTable() into a dataset, and then serializes the dataset to...
13
by: Axel Dahmen | last post by:
Hi, I've got a question on namespaces. After reading http://www.w3.org/TR/xml-names11 I still don't understand how namespaces are applied to attributes - particularly in regard to how processing...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
Oralloy
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,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...

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.