Bug 30042 - XmppReader treats nodes containing only whitespace as empty nodes.
Summary: XmppReader treats nodes containing only whitespace as empty nodes.
Status: RESOLVED FIXED
Alias: None
Product: Wocky
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL: http://git.collabora.co.uk/?p=user/wj...
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-09-06 05:53 UTC by Will Thompson
Modified: 2011-03-29 06:29 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Will Thompson 2010-09-06 05:53:29 UTC
WockyXmppReader seems to treat "<foo>    </foo>" as equivalent to "<foo/>".

This seems harmless, but... it breaks sending people messages containing only whitespace. It's surprising, and I think wrong, that if I send "   " to a contact who uses Gabble, they don't actually get notified for the message I sent them.

By contrast, the padding in "<body>  hai  </body>" is included in the node's content.
Comment 2 Will Thompson 2010-09-06 05:57:54 UTC
I think that this might be caused by Wocky not implementing the ignorableWhitespace xmlSAXHandler vfunc.
Comment 3 Will Thompson 2010-09-20 10:20:38 UTC
Well, the libxml2 documentation on this stuff is terrible.

Even if I implement it, _ignorable_whitespace() is never called. Some searching threw up references to xmlKeepBlanksDefault(), but it appears to make no difference. I think we might be able to feed it a schema that mandates that all whitespace is significant, but I can't figure out how to do that right now.
Comment 4 Will Thompson 2011-03-03 05:28:01 UTC
ARGAHAGHAGHAGHAGHAGH  RGAHGHAGHGHR GRAGHAGHAGHR

_end_element_ns:


  if (priv->node && priv->node->content)
    {
      /* Remove content if it's purely whitespace */
      const char *c;
      for (c = priv->node->content; *c != '\0' && g_ascii_isspace (*c); c++)
        ;
      if (*c == '\0')
        wocky_node_set_content (priv->node, NULL);
    }

RGHghghgh
Comment 5 Jonny Lamb 2011-03-22 08:17:07 UTC
+"  <message to='morse@met.police.uk' from='lewis@met.police.uk'> " \

I'm afraid Morse and Lewis were Oxfordshire police, and so weren't part of the Met. That should be thamesvalley.police.uk.

Looks good otherwise.
Comment 6 Will Thompson 2011-03-29 06:29:47 UTC
Merged with that heinous error corrected!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.