Actually "&" urlencoded -> %26. There is no "&" character in a urlencoded string. Therefore it would be a valid XML, but apparently kannel doesn't recognize it, nor does it recognize the sgml entities.
This is interesting, since in get-urls, it understands urlencoded dlr-url, but not in XML data. It makes sense, though. BR, Nikos ----- Original Message ----- From: Alejandro Guerrieri To: Nikos Balkanas Cc: [email protected] Sent: Sunday, October 25, 2009 2:49 PM Subject: Re: rejection of dlr-url field in CDATA Yep, it is processed but not parsed. That means that you can put whatever you want inside a CDATA construct, and the xml parser will not try to process it, it will be passed as-is to the upper layer. Urlencoding wouldn't do, since "&" is a valid symbol on an url context, but not on an xml document (except inside CDATA of course). You just need to replace non-valid xml characters with their xml-valid counterparts. Apart from special ascii characters (which are rarely part of an url anyway, or are urlencoded already) you should just change: & --> & > --> > < --> < Regards, Alejandro 2009/10/25 Nikos Balkanas <[email protected]> Well from w3c: "The term <![CDATA] is used about text data that should not be parsed by the XML parser." I interpreted this as not been processed, but it seems it is do not parse. Lastly shouldn't dlr-url be urlencoded, addressing all these issues? Nikos ----- Original Message ----- From: Alejandro Guerrieri To: Nikos Balkanas Cc: [email protected] Sent: Sunday, October 25, 2009 12:07 PM Subject: Re: rejection of dlr-url field in CDATA No, any complaint XML parser should treat a CDATA section "as is", without enforcing XML compliance with the data inside. The goal of CDATA is to be able to pass data without having to worry for invalid characters, etc. If you want to ignore something on XML, you should use a <!-- comment -->. I also think the "string hack" is for performance reasons. Besides, ois not a big deal to create valid xml, specially for a simple url: usually just replacing &, > and < for their xml counterparts (& > and <) does the trick (you may need to replace other symbols maybe). Regards, Alejandro 2009/10/25 Nikos Balkanas <[email protected]> Hi, This is expected behaviour. Libxml would also ignore the CDATA secrion, as it should, resulting in an empty dlr-url address, which would also probably fail kannel as malformed. What you want to do is to use test1, but with dlr-url urlencoded. BR, Nikos ----- Original Message ----- From: "Garth Patil" <[email protected]> To: <[email protected]> Sent: Sunday, October 25, 2009 3:08 AM Subject: rejection of dlr-url field in CDATA Hi, I am trying to send a message to the smsbox using the XML format specified here (http://kannel.org/download/1.4.3/userguide-1.4.3/userguide.html#POSTXML). I have attached 2 example documents that should both work properly. The only difference is that the second one has the dlr-url element enclosed in a CDATA section. The message in post_test1.xml succeeds, and the message in post_test2.xml fails with the error "DLR-URL field misformed, rejected" and produces the following logging statement in the smsbox log: 2009-10-24 17:56:10 [4572] [3] DEBUG: Status: 400 Answer: <DLR-URL field misformed, rejected> Any ideas why using a CDATA section around the dlr-url should cause parsing of this field to fail? On a related note, NOT using a CDATA section or otherwise encoding the url causes the XML to be malformed, so if the parser was being strict (try opening it in Firefox) it should fail. Thanks for your help, Garth
