I saw something similar on the sourceforge bugs list but it was from
2001 so I assume it's fixed by now.
O/S: WinXP SP2 and WinCE. Expat lib linked in VC++ 6 SP6.
I have the following XML (simplified for discussion purposes) The XML
starts and ends with the braces.
{
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelo pe xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body >
</soapenv:Body>
</soapenv:Envelop e>}
NOTICE the newline(0A) at the beginning of the file. Now I use the
following C++ code to read from the XML file:
do
{
size_t len = fread(buf, 1, sizeof(buf), xmlfile);
done = len < sizeof(buf);
if (XML_Parse(pars er, buf, len, done) == XML_STATUS_ERRO R)
{
return ReturnLua(State , 1, "Error while parsing.");
}
} while (!done);
This works mint on all other XML files, but not with that one. This is
how the XML file is returned to me by a SOAP server. What happens is
that on first pass through the while loop, XML_Parse doesn't even go
into the functions previously set, it instantly returns
XML_STATUS_ERRO R, and the rest is history.
I would like to know if the error is in my file reading code or an
Expat bug. If it is the latter, is there a patch or quick fix? And if
it is my code, then what could I do to strip the initial newline(s)?
Thanks in advance!
Jeff Lambert 4 2423
Jeff Lambert wrote: {
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelo pe xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/" xmlns:xsd="http ://www.w3.org/2001/XMLSchema" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body > </soapenv:Body> </soapenv:Envelop e>}
NOTICE the newline(0A) at the beginning of the file.
This is not allowed. Nothing is allowed prior to the XML declaration.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
NOTICE the newline(0A) at the beginning of the file. Now I use the
following C++ code to read from the XML file:
That makes the file not well formed, so any parser should reject it.
harsh but fair:-)
David
Jeff Lambert wrote: I saw something similar on the sourceforge bugs list but it was from 2001 so I assume it's fixed by now.
O/S: WinXP SP2 and WinCE. Expat lib linked in VC++ 6 SP6.
I have the following XML (simplified for discussion purposes) The XML starts and ends with the braces.
{
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelo pe xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/" xmlns:xsd="http ://www.w3.org/2001/XMLSchema" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body > </soapenv:Body> </soapenv:Envelop e>}
NOTICE the newline(0A) at the beginning of the file. Now I use the following C++ code to read from the XML file:
do { size_t len = fread(buf, 1, sizeof(buf), xmlfile); done = len < sizeof(buf); if (XML_Parse(pars er, buf, len, done) == XML_STATUS_ERRO R) { return ReturnLua(State , 1, "Error while parsing."); } } while (!done);
This works mint on all other XML files, but not with that one. This is how the XML file is returned to me by a SOAP server. What happens is that on first pass through the while loop, XML_Parse doesn't even go into the functions previously set, it instantly returns XML_STATUS_ERRO R, and the rest is history.
I would like to know if the error is in my file reading code or an Expat bug. If it is the latter, is there a patch or quick fix? And if it is my code, then what could I do to strip the initial newline(s)?
The given sample XML file (with whitespace before the xml declaration)
is processed without errors in my build of XMLgawk with Expat 1.95.8 on
Windows XP. You can find the sources at: http://home.vrweb.de/~juergen.kahrs/gawk/XML/
You can download the source of "XMLpuller" and look how it uses Expat.
NOTE: I work in Windows, but I've tested the input file with both Unix
(LF) and Windows (CR+LF) newlines.
--
To reply by e-mail, please remove the extra dot
in the given address: m.collado -> mcollado
Jeff Lambert wrote: I saw something similar on the sourceforge bugs list but it was from 2001 so I assume it's fixed by now.
O/S: WinXP SP2 and WinCE. Expat lib linked in VC++ 6 SP6.
I have the following XML (simplified for discussion purposes) The XML starts and ends with the braces.
{
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelo pe xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/" xmlns:xsd="http ://www.w3.org/2001/XMLSchema" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body > </soapenv:Body> </soapenv:Envelop e>}
NOTICE the newline(0A) at the beginning of the file. Now I use the following C++ code to read from the XML file:
do { size_t len = fread(buf, 1, sizeof(buf), xmlfile); done = len < sizeof(buf); if (XML_Parse(pars er, buf, len, done) == XML_STATUS_ERRO R) { return ReturnLua(State , 1, "Error while parsing."); } } while (!done);
This works mint on all other XML files, but not with that one. This is how the XML file is returned to me by a SOAP server. What happens is that on first pass through the while loop, XML_Parse doesn't even go into the functions previously set, it instantly returns XML_STATUS_ERRO R, and the rest is history.
I would like to know if the error is in my file reading code or an Expat bug. If it is the latter, is there a patch or quick fix? And if it is my code, then what could I do to strip the initial newline(s)?
Thanks in advance!
Jeff Lambert
Please disregard my previous (cancelled) post about correct processing
in Windows. I was wrong.
My apologies.
--
To reply by e-mail, please remove the extra dot
in the given address: m.collado -> mcollado This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike Brown |
last post by:
Python 2.3 comes with its own version of Expat.
setup.py says it is Expat 1.95.2, but the code in Modules/expat
seems to actually be Expat 1.95.6. It's really 1.95.6, right?
--
Mike
|
by: Doug |
last post by:
I am running solaris 7 on two machines. I compiled python 2.2.1 with
expat parser on one machine. The python binary is located in
/usr/local/bin and the libraries are located in /usr/local/lib. I was
told that if I would tar up the /usr/local/lib/python2.2 directory from
the one machine. I could transfer that and the binaries from
/usr/local/bin to another machine running solaris 7 and all should be
fine. Machine 1 acts as a hub for...
|
by: Ingo Blank |
last post by:
Hi,
while 95% of my 'psycoed' applications run fine, it throws SIGSEGVs in
conjunction with expat. Anybody noticed the same ?
Python 2.3.2 (#4, Nov 13 2003, 02:10:49)
on linux2
$ uname -a
Linux euler 2.4.20-8 #1 Thu Mar 13 17:18:24 EST 2003 i686 athlon i386
|
by: Thomas Guettler |
last post by:
Hi!
What are the difference between xml.parsers.expat
and xml.sax?
Up to now I used xml.sax.make_parser and subclass
from ContentHandler.
I think xml.sax.make_parser uses expat as default.
Why should I want to use xml.parsers.expat?
|
by: alainpoint |
last post by:
Hello,
I use Elementtree to parse an elementary SVG file (in fact, it is one
of the examples in the "SVG essentials" book). More precisely, it is
the fig0201.svg file in the second chapter.
The contents of the file are as follows (i hope it will be rendered
correctly):
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="200" height="200">
| |
by: David Madore |
last post by:
Hi!
Anyone in for a Byzantine discussion on XML well-formedness?
Here's the situation: test.xml contains
--- test.xml: cut after ---
<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE foobar >
<foobar />
|
by: Jakob Møbjerg Nielsen |
last post by:
Expat keeps telling me that there is "junk after document element". I've tried different encoding, and I'm quite sure that the
buffer is nul-terminated. I really have no idea to what the problem might be. Any ideas?
X-POST: comp.lang.c, comp.text.xml (I don't know which group is the right one)
-----Source code-----
#include <stdio.h>
#include <expat.h>
|
by: dwelch91 |
last post by:
Hi, c.l.p.'ers-
I am having a problem with the import of xml.parsers.expat that has
gotten me completely stumped. I have two programs, one a PyQt program
and one a command line (text) program that both eventually call the
same code that imports xml.parsers.expat. Both give me different
results...
The code that gets called is (print statements have been added for
debugging):
|
by: vadlapatlahari |
last post by:
Hi,
I get the following error with Expat while configuring my application server. Can anyone suggest a solution?
When i do an ldd, i get the following :
$ldd Expat.so
Expat.so needs:
/usr/lib/libc.a(shr.o)
Cannot find /unix --- Is there a problem here?
/usr/lib/libcrypt.a(shr.o)
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |