Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

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

 
 
Martin Plantec
Guest
Posts: n/a
 
      10-30-2005
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

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      10-30-2005


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/
 
Reply With Quote
 
 
 
 
Martin Plantec
Guest
Posts: n/a
 
      10-30-2005
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

 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      10-30-2005


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/
 
Reply With Quote
 
Tjerk Wolterink
Guest
Posts: n/a
 
      10-30-2005
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.
 
Reply With Quote
 
Nick Kew
Guest
Posts: n/a
 
      10-30-2005
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
 
Reply With Quote
 
Martin Plantec
Guest
Posts: n/a
 
      10-30-2005
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

 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      10-31-2005
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

 
Reply With Quote
 
Martin Plantec
Guest
Posts: n/a
 
      10-31-2005
<< 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.

 
Reply With Quote
 
Martin Plantec
Guest
Posts: n/a
 
      10-31-2005
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...

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javamail code in servlet works locally, but not when uploaded to host rexdtripod@hotmail.com Java 7 12-06-2006 07:26 PM
XML::Parser Installation error: XML-Parser-2.34 Sean Perl Misc 3 10-03-2006 01:23 AM
XML::Parser Installation error: XML-Parser-2.34 Sean Perl Misc 0 10-02-2006 06:20 PM
XML-Parser to XML-Parser communication (encoding issues?) arne Perl Misc 0 09-13-2005 12:53 PM
XML DOM Parser not working on a remote host Lobo Bravo Java 1 02-23-2004 06:37 AM



Advertisments