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

Manipulating XML REQUEST withing ASP

SP
Hi I have a problem with a customer's XML being submitting to me in a
non-well-format XML.
They said that there are 18 other partners who has been able to tweak the
XML to make it work.
So I guess here is my question, in ASP, when working with XML, how do you
handle non-well-formed XML documents on the "listener" response side?

Here's the scenerio:

Customer post XML Data to us (non-well-formed XML)
ie: <sites>
<mytag1>http://sonny.com/</mytag1>
<mytag2><![CDATA[http://google.com?search=hellow+world&language=EN]]></mytag2>
<mytag3>http://mysite.com/helloworld/?myvar1=123&myvar2=abc</mytag3>
</sites>

Looking at the XML data above the mytag1 and mytag2 are fully W3C XML
conformed XML syntax, however the mytag3 is NOT. there are 2 tags in XML
that are considered illegal characters in XML data, the "&" and the "<". In
our case it's the "&" that's giving us grief.

Ok continue on, the customer sends this messed up format to me and I open it
up with the MSXML DOM object and it craps out. Because it can't load the
REQUEST XML.

Anyone know how to PULL the REQUEST value to a STRING variable? here are
some sample codes I've tried.
sample 1.
Set X = server.createobject("Microsoft.XMLDOM")
X.async = False
X.Load(REQUEST)
strXML = X.xml
Response.ContentType="text/xml"
Response.Write strXML

Sample 2.
strXML = cstr(REQUEST)
Response.ContentType="text/xml"
Response.Write strXML

Both doesn't work with the non-well-formed XML sent, Sample 2 doesn't work
regardless, however Sample 1 does work with a well structured XML document.
Anyone know how I can pull the XML from the REQUEST so that I can manipulate
the string and format it so that it is parsable by the XMLDOM?

Thanks,

Sonny
Aug 3 '05 #1
4 2870
What do you get with:

Response.write Server.HTMLEncode(Request.Form) or Response.write
Server.HTMLEncode(Request.QueryString)

--
--Mark Schupp
"SP" <sp*********@thealliedgrp.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
Hi I have a problem with a customer's XML being submitting to me in a
non-well-format XML.
They said that there are 18 other partners who has been able to tweak the
XML to make it work.
So I guess here is my question, in ASP, when working with XML, how do you
handle non-well-formed XML documents on the "listener" response side?

Here's the scenerio:

Customer post XML Data to us (non-well-formed XML)
ie: <sites>
<mytag1>http://sonny.com/</mytag1>

<mytag2><![CDATA[http://google.com?search=hellow+world&language=EN]]></mytag2>
<mytag3>http://mysite.com/helloworld/?myvar1=123&myvar2=abc</mytag3>
</sites>

Looking at the XML data above the mytag1 and mytag2 are fully W3C XML
conformed XML syntax, however the mytag3 is NOT. there are 2 tags in XML
that are considered illegal characters in XML data, the "&" and the "<".
In our case it's the "&" that's giving us grief.

Ok continue on, the customer sends this messed up format to me and I open
it up with the MSXML DOM object and it craps out. Because it can't load
the REQUEST XML.

Anyone know how to PULL the REQUEST value to a STRING variable? here are
some sample codes I've tried.
sample 1.
Set X = server.createobject("Microsoft.XMLDOM")
X.async = False
X.Load(REQUEST)
strXML = X.xml
Response.ContentType="text/xml"
Response.Write strXML

Sample 2.
strXML = cstr(REQUEST)
Response.ContentType="text/xml"
Response.Write strXML

Both doesn't work with the non-well-formed XML sent, Sample 2 doesn't work
regardless, however Sample 1 does work with a well structured XML
document.
Anyone know how I can pull the XML from the REQUEST so that I can
manipulate the string and format it so that it is parsable by the XMLDOM?

Thanks,

Sonny

Aug 3 '05 #2
SP
Nothing gets returned back.
I've added the below to make sure that the page was reached and sure enough
only the attached string was returned... no REQUEST Value returned.

Response.write Server.HTMLEncode(Request.Form) & " NADDA FORM"
Response.write Server.HTMLEncode(Request.QueryString) & " NADDA QSTRING"

"Mark Schupp" <no******@email.net> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
What do you get with:

Response.write Server.HTMLEncode(Request.Form) or Response.write
Server.HTMLEncode(Request.QueryString)

--
--Mark Schupp
"SP" <sp*********@thealliedgrp.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
Hi I have a problem with a customer's XML being submitting to me in a
non-well-format XML.
They said that there are 18 other partners who has been able to tweak the
XML to make it work.
So I guess here is my question, in ASP, when working with XML, how do you
handle non-well-formed XML documents on the "listener" response side?

Here's the scenerio:

Customer post XML Data to us (non-well-formed XML)
ie: <sites>
<mytag1>http://sonny.com/</mytag1>

<mytag2><![CDATA[http://google.com?search=hellow+world&language=EN]]></mytag2>
<mytag3>http://mysite.com/helloworld/?myvar1=123&myvar2=abc</mytag3>
</sites>

Looking at the XML data above the mytag1 and mytag2 are fully W3C XML
conformed XML syntax, however the mytag3 is NOT. there are 2 tags in XML
that are considered illegal characters in XML data, the "&" and the "<".
In our case it's the "&" that's giving us grief.

Ok continue on, the customer sends this messed up format to me and I open
it up with the MSXML DOM object and it craps out. Because it can't load
the REQUEST XML.

Anyone know how to PULL the REQUEST value to a STRING variable? here are
some sample codes I've tried.
sample 1.
Set X = server.createobject("Microsoft.XMLDOM")
X.async = False
X.Load(REQUEST)
strXML = X.xml
Response.ContentType="text/xml"
Response.Write strXML

Sample 2.
strXML = cstr(REQUEST)
Response.ContentType="text/xml"
Response.Write strXML

Both doesn't work with the non-well-formed XML sent, Sample 2 doesn't
work regardless, however Sample 1 does work with a well structured XML
document.
Anyone know how I can pull the XML from the REQUEST so that I can
manipulate the string and format it so that it is parsable by the XMLDOM?

Thanks,

Sonny


Aug 4 '05 #3
Maybe you can open the request object with an ADODB stream object. Otherwise
you will probably have to use Request.BinaryRead to get the data. You might
also have a look at the soap toolkit to see if it can recover badly formed
XML.

--
--Mark Schupp
"SP" <sp*********@thealliedgrp.com> wrote in message
news:eL**************@tk2msftngp13.phx.gbl...
Nothing gets returned back.
I've added the below to make sure that the page was reached and sure
enough only the attached string was returned... no REQUEST Value returned.

Response.write Server.HTMLEncode(Request.Form) & " NADDA FORM"
Response.write Server.HTMLEncode(Request.QueryString) & " NADDA QSTRING"

"Mark Schupp" <no******@email.net> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
What do you get with:

Response.write Server.HTMLEncode(Request.Form) or Response.write
Server.HTMLEncode(Request.QueryString)

--
--Mark Schupp
"SP" <sp*********@thealliedgrp.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
Hi I have a problem with a customer's XML being submitting to me in a
non-well-format XML.
They said that there are 18 other partners who has been able to tweak
the XML to make it work.
So I guess here is my question, in ASP, when working with XML, how do
you handle non-well-formed XML documents on the "listener" response
side?

Here's the scenerio:

Customer post XML Data to us (non-well-formed XML)
ie: <sites>
<mytag1>http://sonny.com/</mytag1>

<mytag2><![CDATA[http://google.com?search=hellow+world&language=EN]]></mytag2>
<mytag3>http://mysite.com/helloworld/?myvar1=123&myvar2=abc</mytag3>
</sites>

Looking at the XML data above the mytag1 and mytag2 are fully W3C XML
conformed XML syntax, however the mytag3 is NOT. there are 2 tags in XML
that are considered illegal characters in XML data, the "&" and the "<".
In our case it's the "&" that's giving us grief.

Ok continue on, the customer sends this messed up format to me and I
open it up with the MSXML DOM object and it craps out. Because it can't
load the REQUEST XML.

Anyone know how to PULL the REQUEST value to a STRING variable? here are
some sample codes I've tried.
sample 1.
Set X = server.createobject("Microsoft.XMLDOM")
X.async = False
X.Load(REQUEST)
strXML = X.xml
Response.ContentType="text/xml"
Response.Write strXML

Sample 2.
strXML = cstr(REQUEST)
Response.ContentType="text/xml"
Response.Write strXML

Both doesn't work with the non-well-formed XML sent, Sample 2 doesn't
work regardless, however Sample 1 does work with a well structured XML
document.
Anyone know how I can pull the XML from the REQUEST so that I can
manipulate the string and format it so that it is parsable by the
XMLDOM?

Thanks,

Sonny



Aug 4 '05 #4
SP
Mark Thanks for the help, I was able to overcome this obstacle by using the
Request.BinaryRead then using my own function to convert Bytes to ASCII.
Here's my code.

lngByteSize = Request.TotalBytes
s = BytesToText(Request.BinaryRead(lngByteSize))

Function BytesToText(strBytes)
Dim lngLength, lngIndex, lngAsciiCode
strAsciiText lngLength = LenB(strBytes)
For lngIndex = 1 To lngLength
lngAsciiCode = AscB(MidB(strBytes, lngIndex, 1))
strAsciiText = strAsciiText & Chr(lngAsciiCode)
Next
BytesToText = strAsciiText
End Function

"Mark Schupp" <no******@email.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Maybe you can open the request object with an ADODB stream object.
Otherwise you will probably have to use Request.BinaryRead to get the
data. You might also have a look at the soap toolkit to see if it can
recover badly formed XML.

--
--Mark Schupp
"SP" <sp*********@thealliedgrp.com> wrote in message
news:eL**************@tk2msftngp13.phx.gbl...
Nothing gets returned back.
I've added the below to make sure that the page was reached and sure
enough only the attached string was returned... no REQUEST Value
returned.

Response.write Server.HTMLEncode(Request.Form) & " NADDA FORM"
Response.write Server.HTMLEncode(Request.QueryString) & " NADDA QSTRING"

"Mark Schupp" <no******@email.net> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
What do you get with:

Response.write Server.HTMLEncode(Request.Form) or Response.write
Server.HTMLEncode(Request.QueryString)

--
--Mark Schupp
"SP" <sp*********@thealliedgrp.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
Hi I have a problem with a customer's XML being submitting to me in a
non-well-format XML.
They said that there are 18 other partners who has been able to tweak
the XML to make it work.
So I guess here is my question, in ASP, when working with XML, how do
you handle non-well-formed XML documents on the "listener" response
side?

Here's the scenerio:

Customer post XML Data to us (non-well-formed XML)
ie: <sites>
<mytag1>http://sonny.com/</mytag1>

<mytag2><![CDATA[http://google.com?search=hellow+world&language=EN]]></mytag2>
<mytag3>http://mysite.com/helloworld/?myvar1=123&myvar2=abc</mytag3>
</sites>

Looking at the XML data above the mytag1 and mytag2 are fully W3C XML
conformed XML syntax, however the mytag3 is NOT. there are 2 tags in
XML that are considered illegal characters in XML data, the "&" and the
"<". In our case it's the "&" that's giving us grief.

Ok continue on, the customer sends this messed up format to me and I
open it up with the MSXML DOM object and it craps out. Because it can't
load the REQUEST XML.

Anyone know how to PULL the REQUEST value to a STRING variable? here
are some sample codes I've tried.
sample 1.
Set X = server.createobject("Microsoft.XMLDOM")
X.async = False
X.Load(REQUEST)
strXML = X.xml
Response.ContentType="text/xml"
Response.Write strXML

Sample 2.
strXML = cstr(REQUEST)
Response.ContentType="text/xml"
Response.Write strXML

Both doesn't work with the non-well-formed XML sent, Sample 2 doesn't
work regardless, however Sample 1 does work with a well structured XML
document.
Anyone know how I can pull the XML from the REQUEST so that I can
manipulate the string and format it so that it is parsable by the
XMLDOM?

Thanks,

Sonny



Aug 4 '05 #5

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

Similar topics

4
by: Michael J. Astrauskas | last post by:
Does anyone have a function for manipulating GET variables in a URL? I want to be able to modify some parameters without affecting others. An example of what I'm looking for: Let's say the...
12
by: agent349 | last post by:
Hi, I'm fairly new to c++. I need user input in the form of dollar amounts, ie: "$10.00". I'd like to remove the dollar sign "$" then store the rest in a variable. How do I go about removing the...
1
by: stuart | last post by:
Hi, I have seen this on a site: www.sitename.co.uk/showdetails.asp_Q_ThisID_E_123 Obivously this is some sort of querystring manipulation going on behind the scenes. I think I have...
5
by: Sean Wolfe | last post by:
I have a request for the c# compiler one that is an obvious oversight in my opinion. I'm not sure if this is already being implemented in Whidebey, bu i would hope to find it in there, or in the...
6
by: Tom Rowton | last post by:
This one has me a bit confused and I'm not finding what I need in the MSDN or by searching these forums, so here goes... I have a rather large, complex code-in-page WebForm (don't ask) and a...
6
by: Michael Sherwood | last post by:
I want to use VB .NET to fill in forms and submit a response to a remote Web server which uses Javascript and .asp. It seems to me that I need some type of Java interpreter within my VB code...
3
by: pbd22 | last post by:
Hi. I have an event handler in VB.NET that gets called several times. The output of the event handler is XML that is being called by an xmlhttp request from the client. I am using a...
2
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi Guys, I'm using dreamweavers login behaviour to log people in, I've managed to manipulate it a little as I have many sites using the same database, but I'd like to manipulate it a little...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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,...
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...

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.