Menu

Loosing whitespace between nodes.

Developer
2003-12-31
2003-12-31
  • Simon Harrison

    Simon Harrison - 2003-12-31

    Hi,

    After posting to the discussion forum about it (probably the wrong place) I've made the changes to the code that IMHO make the documentation correct :-).

    I've changes SkipWhiteSpace and IsWhiteSpace so they switch on condenseWhiteSpace for most cases but attribute parsing, also changed isspace() instances to IsWhiteSpace where possible. The following behavoiur results when parsing and subsequently serialising through an ostream:

    condenseWhiteSpace == true:

    <a>___this__text__</a>
    becomes:
    <a>this_text</a>

    <b>_<a>___this__</a>_</b>
    becomes:
    <b><a>this</a></b>

    etc... basically as before but when:

    condenseWhiteSpace == false:

    <a>___this__text__</a>
    becomes:
    <a>___this__text__</a>

    <b>_<a>___this__</a>_</b>
    becomes:
    <b>_<a>___this__</a>_</b>

    Only the attributes will change, ie

    <this   attr=myattr/>
    becomes:
    <this attr="myattr"/>

    Which I think is as before.  I can try to make up a patch if anyone's interested.

    cheers,

    -Simon.

     
    • Simon Harrison

      Simon Harrison - 2003-12-31

      Ooops.  The attributes haven't come out right I meant:

      <this___attr=myattr/>
      becomes:
      <this_attr="myattr"/>

       
    • Simon Harrison

      Simon Harrison - 2003-12-31

      on re-reading the documentation I have probably been too hasty - my changes don't make it correct at all :-(.

      What they *do* do is to turn condenseWhiteSpace
      into a kind of is-html flag.  That's just my oppinion of the most sensible behaviour, but perhaps another flag is needed to cover the 3 types of whitespace removal.

      Sorry...

       

Log in to post a comment.

MongoDB Logo MongoDB