Hi,
See the Marco's note and also do not use these
>, < (called entities officially). As I understood
that code generates XML and as I can see the
repsponse.write calls are intended to create such things
like: <tblUsers> and so on. The output you are creating is
definitelly not a XML. See these <BR> tags and so on.
In fact you are escaping the XML markups. Well a little
example doneover your code (I am writting without testing
thus check for typing mistakes):
While Not rsUsers.EOF
Response.Write "<tblUsers>" & vbCrLf
For each TblField in rsUsers.Fields
Response.Write "<" & TblField.Name & ">" & TblField.value & _
"</" & TblField.name & ">" & vbCrLf
Next
Response.Write "</tblUsers>" & vbCrLf
rsUsers.MoveNext
Wend
Something like that. vbCrLf can be omitted but with it the
generated code will look better and you will be able to perform
manual cheking.
Notes: The TblField.value should be escaped if you expect some
values to contain resrved XML characters. In other words here is
the place where < must become <. Using Server.HTMLEncode will
be ok for XML in most cases.
See if something else will not be better. Take a look at the MSXML
components and see if creating the XML tree using the components
will be more convenient for you. It will require a bit more code
but will give you some additional opportunities.
-----Original Message-----
From: Chris Mortimer [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 16, 2002 11:32 AM
To: ActiveServerPages
Subject: Re: Returning XML from asp page and other
Ok, I knew someone out there could help.
Ok, although I have two problems I'll address the first problem first and
get to the second problem later.
I am using an AccessXP database which will import xml into my users table.
The Access db will be situated on the clients machine and the XML will
created via an .asp file on our server. I have included the magic .asp
below.
I am assuming that this .asp should be sufficient to return the data.
I know the access side of things works because I produced a version of this
.asp that actually displayed the results and save them to a file and the
access db would import this file.
This indicates, to me, that the xml is correct but for some reason the .asp
file is going wrong somewhere.
Thanks.
<!--#include file="../../Connections/includer.asp" -->
<%
on error resume next
set rsUsers = Server.CreateObject("ADODB.Recordset")
rsUsers.ActiveConnection = MM_NemarkQS_STRING
rsUsers.Source = "SELECT * FROM UsersTable"
rsUsers.CursorType = 0
rsUsers.CursorLocation = 2
rsUsers.LockType = 3
rsUsers.Open()
rsUsers_numRows = 0
response.write "<dataroot
xmlns:od=""urn:schemas-tblUsers-com:officedata""
xmlns:xsi=""http://www.w3.org/2000/10/XMLSchema-instance""
xsi:noNamespaceSchemaLocation=""tblUsers.xsd"">" & "<br>"
While Not rsUsers.EOF
response.write "<tblUsers>" & "<br>"
For each TblField in rsUsers.Fields
Response.Write "<" & TblField.Name &">" & TblField.value &"</" &
TblField.name &">" & "<br>"
Next
response.write "</tblUsers>" & "<br>"
rsUsers.MoveNext
Wend
response.write "</dataroot>"
rsUsers.Close()
set rsUsers = nothing
%>
----- Original Message -----
From: "Michael Elfial" <[EMAIL PROTECTED]>
To: "ActiveServerPages" <[EMAIL PROTECTED]>
Sent: Thursday, August 15, 2002 4:54 PM
Subject: RE: Returning XML from asp page and other
> Hm, it is not clear what is the problem. Someone will help
> for sure - this list always helps :) but specify a bit more
> about how the XML is generated and probably a few lines from
> these two pages.
>
> you can generate XML "manualy" - just printing in the output
> or create DOM or use ADO's abilities and so on. I lost the
> track somewhere in the middle of the sentences - that's why more
> details will be probably needed.
>
> -----Original Message-----
> From: Chris [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 15, 2002 5:21 PM
> To: ActiveServerPages
> Subject: Returning XML from asp page and other
>
>
> Can anyone help me?
>
> I have two XML related problems.
>
> Problem 1.
>
> I'm using an offline access xp db to 'importxml' some xml from an asp.
> The db is on the clients machine and he needs to connect online throught
> the db to the .asp to retrieve the xml data.
>
> The .asp querys an online access db and should build the xml based on the
> contents of the table.
>
> The offline db will download a normal .xml file, but not the xml produced
> from the .asp. Why???
>
> Any help on this would be brilliant.
>
> Problem 2.
>
> We need to post some xml via our .asp page to another .asp page on another
> site. Can't seem to get the connection going, code seems correct. Can
> anyone provide any help.
>
> Sorry if these details seem sparse but am willing provide whatever
> information should anyone be able to help.
>
> Chris
>
>
> ---
> You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED]
> To unsubscribe send a blank email to
> %%email.unsub%%
>
>
> ---
> You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED]
> To unsubscribe send a blank email to
%%email.unsub%%
>
---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%
---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]