+ Reply to Thread
Results 1 to 3 of 3

Thread: SgmlReader unexpected white space insertion

  1. #1

    Exclamation SgmlReader unexpected white space insertion

    If I use (in VS2010 C#):

    var reader = new Sgml.SgmlReader
    {
    DocType = "HTML",
    WhitespaceHandling = WhitespaceHandling.Significant,
    CaseFolding = Sgml.CaseFolding.ToLower
    };

    to parse an InputStream containing:

    <P><SPAN class=equation><I>I</I></SPAN><SUB>Z</SUB></P>

    to get XHTML as XML string with .ReadOuterXml() then I get:

    <html>
    <p>
    <span class="equation">
    <i>I</i>
    </span>
    <sub>Z</sub>
    </p>
    </html>

    The problem is that the line break between the span and sub elements causes an additional white space to appear in the rendered document.

    Curiously, if I do the same thing with:

    <p>Before</p>
    <P><SPAN class=equation><I>I</I></SPAN><SUB>Z</SUB></P>

    I receive:

    <html>
    <p>Before</p>
    <p><span class="equation"><i>I</i></span><sub>Z</sub></p></html>

    If I modify the SgmlReader.cs ReadOuterXml method to use xw.Formatting = Formatting.None then there is no issue, but that has the potential to collapse other whitespace I suspect.

    Any ideas why this happens and how to fix it?

  2. #2
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    Filed a tracking issue to look into it: http://youtrack.developer.mindtouch.com/issue/SR-8480
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  3. #3

    Default

    It caused unexpected rejection of empty namespace URI. ..... we can avoid extraneous whitespace node creation for XmlTextReader by setting WhitespaceHandling. ..... XmlParserInput.cs : Now to handle nested PE insertion and correct BaseURI
    Last edited by jasicajhon; 04-08-2013 at 10:38 AM.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts