473,625 Members | 2,600 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

9 New Member
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 27072
dorinbogdan
839 Recognized Expert Contributor
If this thread is not helpful please reply.
Feb 28 '07 #2
dorinbogdan
839 Recognized Expert Contributor
Also, check the XML to have always the attribute values quoted.
See this link.
Feb 28 '07 #3
sushweta8
9 New Member
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 Recognized Expert Contributor
How do you load the XML file or string?
Please include some sample code and XML data.
Mar 2 '07 #5
sushweta8
9 New Member
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 Recognized Expert Contributor
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 Recognized Expert Contributor
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
sushweta8
9 New Member
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
6311
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 structure. There should then be a function to search that structure given the pointer, tag, and an optional attribute. I'm looking initially at only text data, no numbers, though eventuall there will be some binary data (CDATA?). Thanks.
2
3339
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 does System.out.println("$^%$%^^" ); //assume those are Japanese characters that are multibyte under EUC-JP The resulting output looks NOTHING like the characters I typed in. Apparently the character set being used to read the literal is...
7
7067
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
7465
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> Thanks.
3
5057
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). I changed the data type for the structure that contains the XML data from the default "String" to "xml.xmldocument" to enable easy filling of the data. my client code creates an XML document class, fills the data using standard xml dom...
7
9391
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
5314
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 I compile the app on my local machine which is used for development I am able to lauch application with no problem. When I run my web app on my local machine which uses my IIS 5 (WinXP Pro) the application runs fine. But if I connect to server...
0
1719
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 quote character was found. when i run the query second or third time, i get the results in XML alright.
9
1738
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 behavior. char *returnValueFromIniFile(char *iniFilePath,char *keyIntheFile)
0
8251
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8182
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8688
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8352
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8494
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7178
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.