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

XML: a string literal was expected, but no opening quote character was found.

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
Feb 28 '07 #1
8 27017
dorinbogdan
839 Expert 512MB
If this thread is not helpful please reply.
Feb 28 '07 #2
dorinbogdan
839 Expert 512MB
Also, check the XML to have always the attribute values quoted.
See this link.
Feb 28 '07 #3
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
Mar 2 '07 #4
dorinbogdan
839 Expert 512MB
How do you load the XML file or string?
Please include some sample code and XML data.
Mar 2 '07 #5
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
Expand|Select|Wrap|Line Numbers
  1. <%
  2. Response.Buffer = true
  3. Response.Expires=-1444
  4. Response.CacheControl = "no-cache"
  5. Server.ScriptTimeout=10000
  6. Response.CharSet="windows-1252"
  7. Response.ContentType="text/xml"
  8.  
  9. Dim oXMLOutput,oElement,oRs,oCn,iCount,sValue, sCols, iArrayCount, bExists, bLogonPracticeExists
  10.  
  11. Set oCn = server.CreateObject("ADODB.Connection")
  12. Set oRs = server.CreateObject("ADODB.Recordset")
  13. set oXMLOutput=server.CreateObject("MSXML2.DOMDocument")
  14.  
  15. 'connect to the database
  16. oCn.Open Application("gsConnection")
  17.  
  18. 'fetch all the records into the recordset
  19. set oRs=oCn.Execute("gs_get_riskoverview_revised '" & sCriteria & "','" & sData & "','" & sNT_ID & "','" & sStage & "','" & dtStart & "','" & dtEnd & "'")
  20.  
  21. 'sPage name is passed from the corresponding pages from where this page is called through XMLHTTP
  22.  
  23. select case sPage
  24.  
  25. case "Overview"
  26.  
  27. sCols="CURRENT_STAGE,SORT_STAGE,SALES_PROSPECT_CODE,PARTNER_NAME,MANAGER_NAME,RAF_STATUS,LATEST_RAF,COMBINED_OVERALL_RISK,RESEND,ACTIONS"
  28.  
  29. sCols=split(sCols,",")
  30.  
  31. end select
  32.  
  33. 'load the dom object
  34. oXMLOutput.loadXML("<ROWS/>")
  35.  
  36. 'used for inserting an attribute which is not present in the database
  37. bExists=0
  38.  
  39. 'used for checking the existence of logon users practice
  40. bLogonPracticeExists=0
  41.  
  42. do while not oRs.EOF
  43.     Set oElement = oXMLOutput.createElement("ROW")
  44.     oXMLOutput.selectSingleNode("//ROWS").appendChild oElement
  45.     for iArrayCount=lbound(sCols) to ubound(sCols)
  46.         for iCount=0 to oRs.Fields.Count-1
  47.             if sCols(iArrayCount)=oRs.Fields(iCount).Name then
  48.                 if oRs.Fields(iCount).Value=NULL or IsNull(oRs.Fields(iCount).Value) then
  49.                     sValue=""
  50.                 else
  51.                     sValue=oRs.Fields(iCount).Value
  52.                 end if
  53.                 oElement.setAttribute oRs.Fields(iCount).Name,sValue
  54.                 bExists=1
  55.                 exit for
  56.             end if
  57.         next
  58.         if bExists=0 then
  59.             oElement.setAttribute sCols(iArrayCount),""
  60.         end if
  61.         'reset
  62.         bExists=0
  63.     next
  64.  
  65.     'check if the logon user practice is present in the recordset
  66.     'if no then add it in the xml string    
  67.     if sPage="PracticeLoc" or sPage="PracticeGlob" then
  68.         if oRs("UNIT_CODE")=sPracticeCode then
  69.             bLogonPracticeExists=1
  70.         end if
  71.     end if
  72.     oRs.MoveNext
  73. loop
  74.  
  75. 'if the flag bLogonPracticeExists=0 then the recordset has not retrieved 
  76. 'the logon users practice hence added it to the xml string
  77. if (sPage="PracticeLoc" or sPage="PracticeGlob") and bLogonPracticeExists=0 then
  78.     Set oElement = oXMLOutput.createElement("ROW")
  79.     oXMLOutput.selectSingleNode("//ROWS").appendChild oElement
  80.     oElement.setAttribute "UNIT_CODE",sPracticeCode
  81.     oElement.setAttribute "UNIT_NAME",sDescription
  82. end if
  83.  
  84. %>
  85. <?xml version="1.0" encoding="windows-1252"?>
  86. <%
  87. Response.Write oXMLOutput.xml
  88.  
  89. set oXMLOutput=Nothing
  90. set oCn=Nothing
  91. set oRs=Nothing
  92. %>
  93.  
Mar 5 '07 #6
dorinbogdan
839 Expert 512MB
Just for test, try to remove the line (the header should be already set):
Expand|Select|Wrap|Line Numbers
  1. %>
  2. <?xml version="1.0" encoding="windows-1252"?>
  3. <%
  4.  
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.
Mar 5 '07 #7
dorinbogdan
839 Expert 512MB
Hi,
Did you succeed to solve the problem ?
If yes, please let me know, in order to close the thread.
Thanks,
Dorin.
Mar 21 '07 #8
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.
Dec 6 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

16
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...
2
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...
7
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
4
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> ...
3
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)....
7
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
2
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...
0
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...
9
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.