sabre-io / xml

sabre/xml is an XML library that you may not hate.
http://sabre.io/xml/
BSD 3-Clause "New" or "Revised" License
516 stars 77 forks source link

Parsing invalid XML..... #54

Closed LEDfan closed 9 years ago

LEDfan commented 9 years ago

Hi, thanks for this library it helped me a lot :)

There is an error in the XEP-0054 specification. The following XML isn't valid, but is used by the XMPP specification.

<body rid='897878733' xmlns='http://jabber.org/protocol/httpbind' sid='7862'><iq from='test@33.33' to='33.33' type='get' xmlns='jabber:client' id='1:sendIQ'><query xmlns='http://jabber.org/protocol/disco#info' node='undefined#undefined'/></iq><iq type='get' xmlns='jabber:client' id='2:sendIQ'><query xmlns='jabber:iq:roster'/></iq><iq type='get' to='test@33.33' xmlns='jabber:client' id='3:sendIQ'><vCard xmlns='vcard-temp'/></iq></body>

The real problem is the <iq type='get' to='test@33.33' xmlns='jabber:client' id='3:sendIQ'><vCard xmlns='vcard-temp'/></iq element. Causing the following error:

exception 'Sabre\Xml\LibXMLException' with message 'xmlns: URI vcard-temp is not absolute
 on line 1, column 141' in /var/www/owncloud/apps/ojsxc/vendor/sabre/xml/lib/Reader.php:158

Is there a way to ignore this error and just parse the valid xml? Thanks!

evert commented 9 years ago

Honestly I'm not really sure! If libxml can't deal with it, I don't know if we can :/

evert commented 9 years ago

Perhaps it's possible to tell it to surpress warnings?

LEDfan commented 9 years ago

Mm okay. Thanks for the info. I searched to suppress the warning, but didn't find a way. I know replaced the invalid URI with a valid.

evert commented 9 years ago

Glad that worked. Must be frustrating! DAV had a very similar issue in the past, but libxml actually ended up having a pass specifically allowing the DAV: namespace... perhaps posting a libxml bug might work for this too.