[cl-xmpp-devel] Re: problems getting started

David Lichteblau david at lichteblau.com
Tue Oct 16 17:56:03 UTC 2007


Quoting Jason S. Cornez (jcornez at alum.mit.edu):
> Error: Document not well-formed: Bad nesting. "stream:stream" /
> (:XML-DECL "xml" . "version='1.0'")
> Context:
>   Line 1, column 728 in NIL
> 
>   [condition type: WELL-FORMEDNESS-VIOLATION]

... says cxml, and it's right.

I realize this answer is unsatisfactory, but this is a bug in ejabberd.
The XML declaration is not a processing instruction, and must only
appear at the beginning of the document (here: TCP connection), not in
the middle of the content (here: in front of every opening <stream>
tag).

This ejabberd patch fixes the bug for me:

diff -ur ejabberd/src/ejabberd_c2s.erl ejabberd-foo/src/ejabberd_c2s.erl
--- ejabberd/src/ejabberd_c2s.erl	2007-10-16 19:50:25.000000000 +0200
+++ ejabberd-foo/src/ejabberd_c2s.erl	2007-10-16 19:50:19.000000000 +0200
@@ -90,7 +90,6 @@
 -define(C2S_HIBERNATE_TIMEOUT, 90000).
 
 -define(STREAM_HEADER,
-	"<?xml version='1.0'?>"
 	"<stream:stream xmlns='jabber:client' "
 	"xmlns:stream='http://etherx.jabber.org/streams' "
 	"id='~s' from='~s'~s~s>"
diff -ur ejabberd/src/ejabberd_s2s_in.erl ejabberd-foo/src/ejabberd_s2s_in.erl
--- ejabberd/src/ejabberd_s2s_in.erl	2007-10-16 19:50:25.000000000 +0200
+++ ejabberd-foo/src/ejabberd_s2s_in.erl	2007-10-16 19:50:19.000000000 +0200
@@ -67,8 +67,7 @@
 -endif.
 
 -define(STREAM_HEADER(Version),
-	("<?xml version='1.0'?>"
-	 "<stream:stream "
+	("<stream:stream "
 	 "xmlns:stream='http://etherx.jabber.org/streams' "
 	 "xmlns='jabber:server' "
 	 "xmlns:db='jabber:server:dialback' "
Only in ejabberd/src: ejabberd_s2s_in.erl.orig
Only in ejabberd/src: ejabberd_s2s_in.erl.rej
diff -ur ejabberd/src/ejabberd_s2s_out.erl ejabberd-foo/src/ejabberd_s2s_out.erl
--- ejabberd/src/ejabberd_s2s_out.erl	2007-10-16 19:50:25.000000000 +0200
+++ ejabberd-foo/src/ejabberd_s2s_out.erl	2007-10-16 19:50:19.000000000 +0200
@@ -74,7 +74,6 @@
 -define(FSMTIMEOUT, 5000).
 
 -define(STREAM_HEADER,
-	"<?xml version='1.0'?>"
 	"<stream:stream "
 	"xmlns:stream='http://etherx.jabber.org/streams' "
 	"xmlns='jabber:server' "
diff -ur ejabberd/src/ejabberd_service.erl ejabberd-foo/src/ejabberd_service.erl
--- ejabberd/src/ejabberd_service.erl	2007-10-16 19:50:25.000000000 +0200
+++ ejabberd-foo/src/ejabberd_service.erl	2007-10-16 19:50:19.000000000 +0200
@@ -46,7 +46,6 @@
 -endif.
 
 -define(STREAM_HEADER,
-	"<?xml version='1.0'?>"
 	"<stream:stream "
 	"xmlns:stream='http://etherx.jabber.org/streams' "
 	"xmlns='jabber:component:accept' "



More information about the cl-xmpp-devel mailing list