Hi,
I am using technology:ASP with backend: sql server
I'm trying to get the sql query results in XML on my asp page, after a while or so, but i get an alert box saying
XML: a string literal was expected, but no opening quote character was found.
Any help, guidance, suggestion or solution will be greatly appreciated!
Thanks in advance,
Sush
8 27017
If this thread is not helpful please reply.
Also, check the XML to have always the attribute values quoted.
See this link.
Also, check the XML to have always the attribute values quoted.
See this link.
I have checked the quotes around the attributes in the XSL and they are all fine. So that doesn't seem to be the problem
How do you load the XML file or string?
Please include some sample code and XML data.
How do you load the XML file or string?
Please include some sample code and XML data.
ok, here is code, i have only removed "Get form variables" lines of code -
<%
-
Response.Buffer = true
-
Response.Expires=-1444
-
Response.CacheControl = "no-cache"
-
Server.ScriptTimeout=10000
-
Response.CharSet="windows-1252"
-
Response.ContentType="text/xml"
-
-
Dim oXMLOutput,oElement,oRs,oCn,iCount,sValue, sCols, iArrayCount, bExists, bLogonPracticeExists
-
-
Set oCn = server.CreateObject("ADODB.Connection")
-
Set oRs = server.CreateObject("ADODB.Recordset")
-
set oXMLOutput=server.CreateObject("MSXML2.DOMDocument")
-
-
'connect to the database
-
oCn.Open Application("gsConnection")
-
-
'fetch all the records into the recordset
-
set oRs=oCn.Execute("gs_get_riskoverview_revised '" & sCriteria & "','" & sData & "','" & sNT_ID & "','" & sStage & "','" & dtStart & "','" & dtEnd & "'")
-
-
'sPage name is passed from the corresponding pages from where this page is called through XMLHTTP
-
-
select case sPage
-
-
case "Overview"
-
-
sCols="CURRENT_STAGE,SORT_STAGE,SALES_PROSPECT_CODE,PARTNER_NAME,MANAGER_NAME,RAF_STATUS,LATEST_RAF,COMBINED_OVERALL_RISK,RESEND,ACTIONS"
-
-
sCols=split(sCols,",")
-
-
end select
-
-
'load the dom object
-
oXMLOutput.loadXML("<ROWS/>")
-
-
'used for inserting an attribute which is not present in the database
-
bExists=0
-
-
'used for checking the existence of logon users practice
-
bLogonPracticeExists=0
-
-
do while not oRs.EOF
-
Set oElement = oXMLOutput.createElement("ROW")
-
oXMLOutput.selectSingleNode("//ROWS").appendChild oElement
-
for iArrayCount=lbound(sCols) to ubound(sCols)
-
for iCount=0 to oRs.Fields.Count-1
-
if sCols(iArrayCount)=oRs.Fields(iCount).Name then
-
if oRs.Fields(iCount).Value=NULL or IsNull(oRs.Fields(iCount).Value) then
-
sValue=""
-
else
-
sValue=oRs.Fields(iCount).Value
-
end if
-
oElement.setAttribute oRs.Fields(iCount).Name,sValue
-
bExists=1
-
exit for
-
end if
-
next
-
if bExists=0 then
-
oElement.setAttribute sCols(iArrayCount),""
-
end if
-
'reset
-
bExists=0
-
next
-
-
'check if the logon user practice is present in the recordset
-
'if no then add it in the xml string
-
if sPage="PracticeLoc" or sPage="PracticeGlob" then
-
if oRs("UNIT_CODE")=sPracticeCode then
-
bLogonPracticeExists=1
-
end if
-
end if
-
oRs.MoveNext
-
loop
-
-
'if the flag bLogonPracticeExists=0 then the recordset has not retrieved
-
'the logon users practice hence added it to the xml string
-
if (sPage="PracticeLoc" or sPage="PracticeGlob") and bLogonPracticeExists=0 then
-
Set oElement = oXMLOutput.createElement("ROW")
-
oXMLOutput.selectSingleNode("//ROWS").appendChild oElement
-
oElement.setAttribute "UNIT_CODE",sPracticeCode
-
oElement.setAttribute "UNIT_NAME",sDescription
-
end if
-
-
%>
-
<?xml version="1.0" encoding="windows-1252"?>
-
<%
-
Response.Write oXMLOutput.xml
-
-
set oXMLOutput=Nothing
-
set oCn=Nothing
-
set oRs=Nothing
-
%>
-
Just for test, try to remove the line (the header should be already set): -
%>
-
<?xml version="1.0" encoding="windows-1252"?>
-
<%
-
If no success, check carefully the formatting of oXMLOutput.xml string to be correct, because the server is not always adding quotes around the attributes.
Hi,
Did you succeed to solve the problem ?
If yes, please let me know, in order to close the thread.
Thanks,
Dorin.
Hi,
Did you succeed to solve the problem ?
If yes, please let me know, in order to close the thread.
Thanks,
Dorin.
No, I haven't been able to resolve this, the error occurs only when the number of rows returned by the sql query is more.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Mike |
last post by:
Does anyone know of a minimal/mini/tiny/small xml parser
in c? I'm looking for something small that accepts a stream
or string, builds a c structure, and then returns an opaque
pointer to that...
|
by: Robert M. Gary |
last post by:
I'm using JRE 1.5 on Solaris Japanese (Sparc). The JVM claims its default
character set is EUC-JP
I'm seeing two strange things when using Japanese character sets...
1) If I write a program that...
|
by: herrcho |
last post by:
i'm in the course of learning C, and found these two words "string,
string literal" confusing me..
I'd like to know the difference between them.. Thank you
|
by: Guadala Harry |
last post by:
I need to place the following into a string... How can I properly escape the
% " / < and > characters?
<table width="100%" border="0" cellspacing="0" cellpadding="4px"
class="hfAll"></Table>
...
|
by: Jerome Cohen |
last post by:
AI am trying to call a third-party web service. this service expects an XML
fragment that contains the request plus other parameter. adding the web
reference created the syntax below(reference.vb)....
|
by: Jonny |
last post by:
Hi,
I am trying to write a C function which will dequote the string in a
char * variable, and unescape any escaped quotes, so that, for example:
"hello"
would become:
hello
|
by: RdS |
last post by:
Hello,
I use sourcesafe and vb 2003 for my dev environment. on the sourcesafe
server I also have sql2005 and reporting services installed. The web app
references this sql server for db. When...
|
by: sushweta8 |
last post by:
Hi,
technology:ASP, backend: sql server
I'm trying to present the sql query results in XML on my asp page, but i get an alert box saying
XML: a string literal was expected, but no opening...
|
by: somenath |
last post by:
Hi All,
I was going through one piece of code which is written by an
experience programmer and it is working fine.
But I think the use of "strstr" is not proper because it may show
undefined...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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: 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...
| | |