473,404 Members | 2,174 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,404 software developers and data experts.

Pass XML string to ASP Function Problem

Joe
This example outputs "XMLString = Data 1Data 2." When I pass XML string in ASP, i
will output the data only, without <data> anymore. Then how can I retrieve the data one by one?
Any ideas? thank

<
strRequestXML = "<data><field1>Data 1</field1><field2>Data 2</field2></data>
Call SaveData(strRequestXML
%><
Function SaveData(XMLString
Response.Write "XMLString = " & XMLStrin
End Functio
%>
Jul 19 '05 #1
2 1731
Joe wrote:
This example outputs "XMLString = Data 1Data 2." When I pass XML
string in ASP, it
will output the data only, without <data> anymore.
When you View Source, the tags will be there
Then how can I
retrieve the data one by one?? Any ideas? thanks

<%
strRequestXML = "<data><field1>Data 1</field1><field2>Data
2</field2></data>" Call SaveData(strRequestXML)
%><%
Function SaveData(XMLString)
Response.Write "XMLString = " & XMLString
End Function
%>


You need to use an XML Document, and load your xml into it:

set xmldoc = Server.CreateObject("msxml2.domdocument")
xmldoc.loadxml XMLString

Here's an example of using a data island:
http://www.davidpenton.com/testsite/...ta.islands.asp

Bob Barrows
--
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.
Jul 19 '05 #2
"Joe" <an*******@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com...
This example outputs "XMLString = Data 1Data 2." When I pass XML string in ASP, it will output the data only, without <data> anymore. Then how can I retrieve the data one by one?? Any ideas? thanks

<%
strRequestXML = "<data><field1>Data 1</field1><field2>Data 2</field2></data>" Call SaveData(strRequestXML)
%><%
Function SaveData(XMLString)
Response.Write "XMLString = " & XMLString
End Function
%>

If you look at the source, you will see the entire string just as you wrote
it above. The problem is that these are being interpreted by your browser
because they look like HTML elements. If you want print out the string so
it's displayed in the browser, the do this:

Function SaveData(XMLString)
Response.Write "XMLString = " & Server.HTMLEncode(XMLString)
End Function

Regards,
Peter Foti

Jul 19 '05 #3

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

Similar topics

8
by: Vijay | last post by:
Hi all, Im using gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-20) on 64bit linux server im trying to compile following code --------------------sam.cpp--------------------- #include...
1
by: Mark Dicken | last post by:
Hi All I have found the following Microsoft Technet 'Q' Article :- Q210368 -ACC2000: How to Pass an Array as an Argument to a Procedure (I've also copied and pasted the whole contents into...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
9
by: Alan Silver | last post by:
Hello, I'm a bit surprised at the amount of boilerplate code required to do standard data access in .NET and was looking for a way to improve matters. In Classic ASP, I used to have a common...
3
by: steph | last post by:
Hi, I've got below function to dynamically define and run pass-through queries. This works OK. But I don't want to have the connection string hard-coded, instead I want to reuse the existing...
28
by: Bill | last post by:
Hello All, I am trying to pass a struct to a function. How would that best be accomplished? Thanks, Bill
4
by: mwanstall | last post by:
Hi All, I have started tearing my hair out over this problem! I am pulling some data from a table and passing it as variables into a function in Access. One of the variables I'm passing through...
4
by: S. | last post by:
Hi all, I have the requirement that I must pass-by-reference to my function addStudent() and getAge() functions where my getAge() function is within the addStudent() function. I am able to...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.