FIXED [Re: [SoapRMI] Xpp/MxP1 Comment handling]

Aleksander Slominski aslom_at_cs.indiana.edu
Thu, 12 Jun 2003 18:32:17 -0400


hi,

i have fixed the problem it seems to happen only when end-of-line 
normalization is done for comments content - could you try the latest 
code form CVS and verify that problem is fixed?

here are test cases i tried:

    public void testComments2() throws Exception {
         testComments2(" <b>\r\n</b>\n ", " <b>\n</b>\n ");
         testComments2(" <b>\r\n</b>\r\n ", " <b>\n</b>\n ");
         testComments2(" <b>\r\n</b>\r\n", " <b>\n</b>\n");
         testComments2(" <b>\r\n</b>\r\n\r\n", " <b>\n</b>\n\n");
         testComments2("\r\n<b>\n</b>\n ", "\n<b>\n</b>\n ");
         testComments2("<b>\r</b>\n ", "<b>\n</b>\n ");
         testComments2("<b>\n</b>\r", "<b>\n</b>\n");
         testComments2("<b>\r\n</b>","<b>\n</b>");

         testComments2("\n <b>\n</b>\n ");
         testComments2("\n<b>\n</b>\n ");
         testComments2(" <b>\n</b>\n ");
         testComments2("<b>\n</b>\n ");
         testComments2("<b>\n</b>\n");
         testComments2("<b>\n</b>");
         testComments2("<b>- -</b>");
         testComments2("<b>/b>");
    }

    public void testComments2(String value) throws Exception {
        testComments2(value, value);
    }

    public void testComments2(String value, String expected) throws 
Exception {
        XmlPullParser pp = factory.newPullParser();
        final String XML = "<foo>\n<!--"+value+"-->\n</foo>";
        testContentMerging(pp, XML, "\n\n");
        pp.setInput( new StringReader( XML ) );
        pp.require( XmlPullParser.START_DOCUMENT, null, null);
        pp.next();
        pp.require( XmlPullParser.START_TAG, null, "foo");
        pp.nextToken();
        pp.require( XmlPullParser.TEXT, null, null);
        assertEquals("\n", pp.getText());
        pp.nextToken();
        pp.require( XmlPullParser.COMMENT, null, null);
        //System.err.println(getClass()+" 
expected="+printable(expected)+" text="+printable(pp.getText()));
        assertEquals(printable(expected), printable(pp.getText()));
        assertEquals(expected, pp.getText());
        pp.nextToken();
        pp.require( XmlPullParser.TEXT, null, null);
        assertEquals("\n", pp.getText());
        pp.nextToken();
        pp.require( XmlPullParser.END_TAG, null, "foo");
    }

let me know if there the comment content that you had problem was 
different from what i tested so i can add it to test cases.

thanks,

alek

-- 
"Mr. Pauli, we in the back are all agreed that your theory is crazy. 
What divides us is whether it is crazy enough to be true." Niels H. D. Bohr