From: Chabanne Hamma (Chabanne.Hamma@sybase.com)
Date: 30/08/2000 - 12:40
Il me semble que ADO 2.5 le permet
resultset.Save "titles.sav", adPersistXML
"Emmanuel Chaize" <echaize@cosmosbay.com> on 30/08/2000 14:32:59
Please respond to xml-tech@xmlfr.org
To: xml-tech@xmlfr.org
cc: (bcc: Chabanne Hamma/SYBASE)
Subject: [xml-tech] RE: [xml-tech] Création de fichiers XML
avec ADO
Je ne pense pas qu'ADO permette de choisir la structure du XML produit.
En revanche tu peux très bien produire ton propre XML en parcourant le
chaque ligne du resultset et pour chacune d'elle la collection fields().
-----Message d'origine-----
De : xml-tech-bounce@xmlfr.org [mailto:xml-tech-bounce@xmlfr.org]De la
part de Gervais Christophe
Envoyé : mercredi 30 août 2000 12:35
À : xml-tech@xmlfr.org
Objet : [xml-tech] Création de fichiers XML avec ADO
Bonjour,
Ma question porte sur la création de fichiers XML en environnement
microsoft:
Faut il :
1/ reconstituer un fichier XML à partir de la source de données et écrire
ligne par ligne le fichier
ex :
Put #1, "<?xml version=""1.0"" encoding=""ISO-8859-1""?>"
Put #1, "<recordset>"
Put #1, "<DOSSIERS>"
.....
2/ Peut on créer avec le DOM des fichiers XML en se basant sur une DTD et
une requete via ODBC?
3/ autres solution ....
L'exemple que je dispose ne permet pas de structurer mon fichier comme il
est défini dans ma DTD. le fichier est créé à plat à la façon d'un
recordset.
Christophe
<%
'*******************************************************
'* ASP 101 Sample Code - http://www.asp101.com *
'* *
'* This code is made available as a service to our *
'* visitors and is provided strictly for the *
'* purpose of illustration. *
'* *
'* Please direct all inquiries to webmaster@asp101.com *
'*******************************************************
%>
<!-- #include file="adovbs.inc" -->
<%
' Constants file included above.
' Delete existing file
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(Server.MapPath("db_xml.xml")) Then
objFSO.DeleteFile Server.MapPath("db_xml.xml")
End IF
Set objFSO = Nothing
' Declare our variables... always good practice.
Dim cnnXML ' ADO connection
Dim rstXML ' ADO recordset
' Create an ADO Connection to connect to the scratch database.
' We're using OLE DB but you could just as easily use ODBC or a DSN.
Set cnnXML = Server.CreateObject("ADODB.Connection")
' This line is for the Access sample database:
'cnnXML.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
' & Server.MapPath("db_scratch.mdb") & ";"
' We're actually using our site-wide SQL Server connection:
cnnXML.Open Application("SQLConnString"), Application("SQLUsername"), _
Application("SQLPassword")
' Execute a query using the connection object. It automatically
' creates and returns a recordset which we store in our variable.
Set rstXML = Server.CreateObject("ADODB.Recordset")
Set rstXML = cnnXML.Execute("SELECT * FROM scratch ORDER BY id;")
Response.Write "Saving data as XML...<br>" & vbCrLf
' Save the file to XML format.
rstXML.Save Server.MapPath("db_xml.xml"), adPersistXML
' Close our recordset and connection and dispose of the objects
rstXML.Close
Set rstXML = Nothing
cnnXML.Close
Set cnnXML = Nothing
Response.Write "XML file written...<br>" & vbCrLf
Response.Write "Click here to view the file.<br>"
& vbCrLf
%>
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Archive générée par hypermail 2.1.3 le 28/06/2004 - 11:05 UTC
webmaster@xmlfr.org
|