Menu

handling HTML nbsp's?

Developer
kury
2007-10-07
2013-05-20
  • kury

    kury - 2007-10-07

    Is there a way to handle HTML   encodings?  Automatically turn them into spaces perhaps?

    Here is an example of what I'm running into.

    XML I'm parsing: <td valign="top" colspan="2">Aug 21, 2007&nbsp;</td>

    When I code around & get to the text node containing the text between the <TD></TD> tags though all I get is the following.
    "Aug 21, 2007nbsp;" (minus the double quotes)

    So basically my whole question is... where did the "&" go, and How do I get them back? Or.. does TinyXML having something built in to convert these &nbsp;'s to the spaces they are representing?

    Thanks!

     
    • Nicola Civran

      Nicola Civran - 2007-10-08

      Again, TinyXML is a (tiny) XML parser, and "&nbsp;" is not a predefined entity according to XML specifications.
      You can use "&#160;" or "&#xA0;" instead.
      HTH

       

Log in to post a comment.

MongoDB Logo MongoDB