473,805 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

invalid token problem ?

tag
Hi,

I have a xml field:

<Cell Col="2" Row="10">="Actu al Asset mix
"&text($C$46,"d d-mmm-yyyy")</Cell>
^
|
this is column 56

and am getting the following error:

xml.sax._except ions.SAXParseEx ception: <stdin>:21:56 : not well-formed
(invalid token)

I have used the :
self.data += saxutils.escape (characters, self.transhash)

and transhash has :

transhash = { '"' : '&quot;', '&' : '&amp;' }

Can anyone please explain why I am getting the error ? What am I
missing ??

THANKS :)
Jul 18 '05 #1
3 6844
tag wrote:
Can anyone please explain why I am getting the error ? What am I
missing ??
Well the answer is already given:
xml.sax._except ions.SAXParseEx ception: <stdin>:21:56 : not well-formed


Your XML is not well-formed. All quotation marks in CDATA fields (outside of
a tag) must be quoted to &quot;.

You XML should be:

<Cell Col="2" Row="10">=&quot ;Actual Asset mix
&quot;&text($C$ 46,&quot;dd-mmm-yyyy&quot;)</Cell>

Thomas
Jul 18 '05 #2
tag
Thomas Krüger <th************ @gmx.net> wrote in message news:<ch******* ******@news.t-online.com>...
Your XML is not well-formed. All quotation marks in CDATA fields (outside of
a tag) must be quoted to &quot;.
I got that part :)
You XML should be:
<Cell Col="2" Row="10">=&quot ;Actual Asset mix
&quot;&text($C$ 46,&quot;dd-mmm-yyyy&quot;)</Cell>


but they are - it is complaining about the :
&text part ... the '"' 's are converted into &quot; ...

any other suggestions ?
Jul 18 '05 #3
tag wrote:
Thomas Krüger <th************ @gmx.net> wrote in message
news:<ch******* ******@news.t-online.com>...
Your XML is not well-formed. All quotation marks in CDATA fields (outside
of a tag) must be quoted to &quot;.


I got that part :)
You XML should be:
<Cell Col="2" Row="10">=&quot ;Actual Asset mix
&quot;&text($C$ 46,&quot;dd-mmm-yyyy&quot;)</Cell>


but they are - it is complaining about the :
&text part ... the '"' 's are converted into &quot; ...

any other suggestions ?


I think you misunderstood - the original xml is invalid. In your short
snippet you could remedy that by snippet = snippet.replace ("&", "&amp;")
_before_ feeding it to the parser. Unfortunately this doesn't work in the
general case because not all occurences of '&' may be literal ampersand
chars and not all occurences of '<' and '>' may be markup. Therefore what
you need to do is to fix the program that _generates_ the invalid xml not
the one that tries to parse it and fails. If the generating program is in
python, you can use xml.saxutils.es cape() to process the literal text
snippets, but only those.

Peter

Jul 18 '05 #4

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

Similar topics

4
4740
by: Erik H. | last post by:
I have an ASPX page in which I am trying to bind a datagrid to a dataset pulled from Microsoft Access DB using code inline method. For some reason, the compiler is having a problem with 'using'. Any help here would be much appreciated. Thanks! Getting the following error: CS1519: Invalid token 'using' in class, struct, or interface member declaration My Code:
0
1352
by: s.caron | last post by:
Hi, I'm trying to open an aspx page but I have this error Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member declaration in the line : usuario.Credentials = System.Net.CredentialCache.DefaultCredentials; If I put this code in a method like Page_load
3
13741
by: Erik H. | last post by:
I have an ASPX page in which I am trying to bind a datagrid to a dataset pulled from Microsoft Access DB using code inline method. For some reason, the compiler is having a problem with 'using'. Any help here would be much appreciated. Thanks! Getting the following error: Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify...
3
2724
by: Twanger | last post by:
I'm getting a compiler error on my ASP.NET page and I can't see the cause. I have a simple C# class compiled into a DLL and placed in my bin directory which has a public property QuestionText. When I try and set the property the compiler throws up Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member declaration If I don't try and set the property it prints out the default value of the property fine.
3
1545
by: Andy Sutorius via DotNetMonster.com | last post by:
With this line (asp.net/c#): colNameVal = System.Configuration.ConfigurationSettings.AppSettings; I get "invalid token '=' in declaration". I also get it for "invalid token ';' in declaration". I don't understand what the compiler is trying to say. Can you clarify/solve? -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200601/1
9
2704
by: Nelmr1 | last post by:
I'm using 2002.Net, 1.0 framwork. I am basically learning C# so I wrote this and get invalid token errors. Does anyone see why? using System; namespace ConsoleApplication2 {
3
4231
by: John Hopper | last post by:
I have an xml document, created using xmlTextWriter, at(http://www.supremecourtofohio.gov/rss/docketitems/2006-1942.xml) that won't validate. It fails with "invalid token, document not well formed". Then if I open the same file in notepad, save it without changing anything, and try again, it validates (I'm using http://www.rssvalidator.org). So I'm thinking there are invalid characters that notepad is removing ?? But what are they and why?...
4
7349
by: jvictor118 | last post by:
I've been using the xml.sax.handler module to do event-driven parsing of XML files in this python application I'm working on. However, I keep having really pesky invalid token exceptions. Initially, I was only getting them on control characters, and a little "sed -e 's/ ]/ /g' $1;" took care of that just fine. But recently, I've been getting these invalid token excpetions with n-tildes (like the n in España), smart/fancy/curly quotes and...
3
4684
by: brad | last post by:
This works: This does not (one the end, 09 is used instead of 9) File "<stdin>", line 1 area_group = {001:06, 002:04, 003:04, 006:09} SyntaxError: invalid token Why does 09 cause an invalid token while 9 does not?
0
9718
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
10613
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...
1
10368
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
10107
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
9186
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...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
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
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.