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

Locally working XSLT fails on host with message "Sablotron error on line 1: XML parser error 4: not well-formed"

Hello,

I have managed (with your help!) to make a working XSLT stylesheet; it
works fine locally (Windows Apache + PHP with Sablotron 1.0), but it
fails on the remote host (FreeBSD Apache + PHP with Sablotron 1.0) with
the following:

Warning: Sablotron error on line 1: XML parser error 4: not well-formed
(invalid token) in /...host...path.../page.php on line 28
FAILURE : XML parser error 4: not well-formed (invalid token) ; error
code is 2

Line 28 (of page.php) is the line with the call to xslt_process, while
line 1 (of the stylesheet) reads:

<?xml version="1.0" encoding="iso-8859-1"?>

What can possibly be wrong?

Note: I have of course some PHP code which sets the correct directory
depending on the machine we are on (local or remote).

Thanks!

Martin

Oct 30 '05 #1
9 4746


Martin Plantec wrote:
Warning: Sablotron error on line 1: XML parser error 4: not well-formed
(invalid token) in /...host...path.../page.php on line 28
FAILURE : XML parser error 4: not well-formed (invalid token) ; error
code is 2

Line 28 (of page.php) is the line with the call to xslt_process, while
line 1 (of the stylesheet) reads:

<?xml version="1.0" encoding="iso-8859-1"?>

What can possibly be wrong?


I would guess that some path is wrong and somehow you don't pass in the
XML and/or the stylesheet you want.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 30 '05 #2
Martin,

Encouraged by your help, I tried to localize the problem. There was no
path problem (a bad path produced another error). But I realized that
removing the 2nd line of my XML (not the 1st as mentionned in the error
message), which was a DOCTYPE declaration (external DTD with SYSTEM
id), it worked fine on the remote host, too.

I got curious and I tried to keep the doctype line, but to empty the
external DTD (keep the file, remove the declarations). I know Sablotron
doesn't use it anyway... It worked. So I tried to restore parts of the
DTD, to see what was a problem to Sablotron.

It turns out that it was 8 bit characters in the comments. Sigh.

The "line 1" in the error actually referred to line 1 of the external
DTD, where there was the first comment with one 8 bit char...

Thanks!

Martin

Oct 30 '05 #3


Martin Plantec wrote:

It turns out that it was 8 bit characters in the comments. Sigh.

The "line 1" in the error actually referred to line 1 of the external
DTD, where there was the first comment with one 8 bit char...


An external DTD is allowed to declare its encoding with
<?xml version="1.0" encoding="encodingHere"?>
see
<http://www.w3.org/TR/REC-xml/#sec-TextDecl>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 30 '05 #4
Martin Plantec wrote:
Hello,

I have managed (with your help!) to make a working XSLT stylesheet; it
works fine locally (Windows Apache + PHP with Sablotron 1.0), but it
fails on the remote host (FreeBSD Apache + PHP with Sablotron 1.0) with
the following:

Warning: Sablotron error on line 1: XML parser error 4: not well-formed
(invalid token) in /...host...path.../page.php on line 28
FAILURE : XML parser error 4: not well-formed (invalid token) ; error
code is 2

Just a side-note:

I used to build webapplications in php,
and i used sablotron as xslt processor...
What i learned: Sablotron is a lousy xmlt processor,
bad error reporting etc etc.

Okay it is fast.. but not very productive.
Oct 30 '05 #5
Tjerk Wolterink wrote:
I used to build webapplications in php,
but now you know better:-)
and i used sablotron as xslt processor...
What i learned: Sablotron is a lousy xmlt processor,
bad error reporting etc etc.
Haven't used it since 0.6 or thereabouts, but wasn't sorry
to switch away from it.
Okay it is fast.. but not very productive.


Fast???? Quite the opposite, according to xmlbench.

In the context of Apache, you should use one of the XSLT
filter modules - such as mod_transform - for XSLT apps.
That uses libxslt, which xmlbench finds up to 10 times
faster than sablotron, as well as being nice to use.

I still consider *any* XSLT slower than I want to run on
a webserver if I can help it (OK I do use it:-). Sax-based
filters are what you really want to process XML on the fly.

--
Nick Kew
Oct 30 '05 #6
Martin : Thanks, and yes, I confirm that adding <?xml version="1.0"
encoding="iso-8859-1"?> (in my case) at the beginning of the DTD solves
the problem.

Tjerk and Nick: Thanks for your comments about Sablotron. I am posting
another topic about this to follow up on them...

Martin

Oct 30 '05 #7
Martin Plantec wrote:
Hello,

I have managed (with your help!) to make a working XSLT stylesheet; it
works fine locally (Windows Apache + PHP with Sablotron 1.0), but it
fails on the remote host (FreeBSD Apache + PHP with Sablotron 1.0)
with the following:

Warning: Sablotron error on line 1: XML parser error 4: not
well-formed (invalid token) in /...host...path.../page.php on line 28
FAILURE : XML parser error 4: not well-formed (invalid token) ; error
code is 2

Line 28 (of page.php) is the line with the call to xslt_process, while
line 1 (of the stylesheet) reads:
a) How do you know it's the stylesheet that the error is referring to,
and not the XML document?
<?xml version="1.0" encoding="iso-8859-1"?>
b) the error message may not be counting the XML Declaration as a line
of the document: look further at both stylesheet and document
instance.
What can possibly be wrong?


In these cases, ALWAYS run a standalone command-line parse or validation
using one of the known, stable processors, independently of your own
application code. See http://xml.silmaril.ie/authors/parsers/ for
details.

///Peter

Oct 31 '05 #8
<< a) How do you know it's the stylesheet that the error is referring
to,
and not the XML document? >>

Typo: I meant the XML document. As it turned out later (see my later
post), the problem was in the external DTD for the XML document
(comments with 8 bits chars).

<< b) the error message may not be counting the XML Declaration as a
line
of the document: look further at both stylesheet and document
instance. >>

Apparently, the error messages refer to line number in files (in the
usual sense, all lines count); but it may be different files (here, the
external DTD for the XML).

<< In these cases, ALWAYS run a standalone command-line parse or
validation >>

I validate all my documents with SP (onsgmls). That may not be the last
fad in XML parser, I don't know (my whole system was developped years
ago, and I am no professional computer scientist), but it works well.
The problem here was that my documents validate fine, and that the 8
bit characters in DTD comments are not a problem to onsgmls.

Thanks for your comments.

Oct 31 '05 #9
Sorry for clumsy quoting, but I am using groups.google.com and I have
not yet figured how to quote the message I reply to...

Oct 31 '05 #10

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

Similar topics

3
by: N. Graves | last post by:
Hello, I don't understand this error message." Error accessing File. Network Connection may have been lost." I'm not using any network connection for the database. In the VBA editor is goes...
6
by: Tony | last post by:
Dear All, When I run an example program on the http://www.dotnetjunkies.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/data/datagrid1.src&file=VB\datagrid1.aspx&font=3 ...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
3
by: filip.norrgard | last post by:
Hi All! I've been developing an ASP.Net 2.0 web application using the Visual Studio 2005 tools. Currently datagrids on a page are filled with data from a dataset (a .xsd file in the "project")...
1
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
0
by: ravinder1983 | last post by:
Hi All, I am new to this world of php. I tried getting oci8 work with php but to no avail. The error i recieve is "Warning: ocilogon() : OCIEnvNlsCreate() failed. There is something wrong with...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
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...

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.