473,769 Members | 4,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateOb ject("MSXML2.DO MDocument")

'LOAD DATA
'dim objRS : set objRS = m_Connection.Ex ecute(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\www root\testarea\c ritiqueformdata .xml")
the resulting XML starts off with

<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">

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>
<CritiqueFormDa ta>
<ModuleName>M y Module</ModuleName>
<date>30 January</date>
<Active>0</Active>
</CritiqueFormDat a>
<CritiqueFormDa ta>
<ModuleName>M y 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="#criti queformdata" width="700px" border="1">
<tr>
<td><span id="coursetitle " datasrc="#criti queformdata"
datafld="Module Name"></span></td>
etc....
THANKS in advance!

ferd

Jan 11 '06 #1
3 3130
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: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:updatable="t rue">

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
4812
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 first name, last name, age, unique teacher number, etc is in the file. I want to return the unique teacher number, for example, of the teacher whose first name is Jane and last name is Doe. How does one do this?
25
3095
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 to/associated with? My understanding was that baz above belongs to some "default default namespace", but I have not been able to
1
5879
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 multiple Instances of 1 form. I have a Form frmSource from which I have multiple Instances, each with a unique Identifier. So when I Load or Close a specific instance, I want to load or save the Settings (Top, Height, Width, etc) in an XML-file....
3
1394
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 with a streamwriter object ? Any idea ? Thanks in advance -------------------------------- From: Edward Grosso ----------------------- Posted by a user from .NET 247 (http://www.dotnet247.com/)
6
13998
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 and error 'Object reference not set to an instance of an object.' as soon as I try to access the data in the fields, I.e. at the line that reads 'KeyFlags(i) = rstFields("keyflag").value'
22
5053
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 calling up another form or report that uses some of the same data. We came up with a work around that saves the current record's ID, does a
5
2663
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 during a phone call with a client. Since it's long, I put six Save buttons down the length of the form and asked the users to save often. When they click the Save buttons, the data is saved to a central database and a text label is changed to say...
3
2138
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 XML. I need to strip all of the qualified type information and the rest of the junk from the serialized XML. Is there a recommended approach to this sort of issue? 1.1 output (I want): <DataType>System.Int32</DataType>
13
2527
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 applications are supposed to determine the proper validation DTD. In the following XML: ------------- <?xml version="1.0" ?>
0
9579
marktang
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10199
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, 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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9850
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 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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8862
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5293
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5436
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3948
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
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.