CVS Update: xmlpull-api-v1/src/xml/tests

Aleksander Andrzej Slominski <[email protected]>
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
aslom       02/09/07 15:39:46

  Modified:    src/java/tests/org/xmlpull/v1/tests PackageTests.java
                        TestEvent.java TestSerializeWithNs.java
                        TestToken.java TestXmlCdsect.java
                        TestXmlSimple.java UtilTestCase.java
                        XmlTestCase.java
               src/xml/tests cdsect.xml simple.xml
  Added:       src/java/tests/org/xmlpull/v1/tests TestCdsect.java
               src/xml/tests cdsect_eol.xml cdsect_mixed.xml
                        cdsect_more.xml simple2.xml
  Log:
  exapnded tests for CDATA handling
  
  Revision  Changes    Path
  1.15      +19 -6     xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/PackageTests.java
  
  Index: PackageTests.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/PackageTests.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -t -w -r1.14 -r1.15
  --- PackageTests.java	2002/08/23 19:11:51	1.14
  +++ PackageTests.java	2002/09/07 20:39:44	1.15
  @@ -4,12 +4,12 @@
   package org.xmlpull.v1.tests;
   
   import junit.framework.Test;
  -import junit.framework.TestCase;
   import junit.framework.TestResult;
   import junit.framework.TestSuite;
   import junit.textui.TestRunner;
  -
  +import org.xmlpull.v1.XmlPullParser;
   import org.xmlpull.v1.XmlPullParserFactory;
  +import org.xmlpull.v1.XmlSerializer;
   
   /**
    * TODO: add tests for
  @@ -21,6 +21,10 @@
    */
   public class PackageTests extends TestRunner
   {
  +    private static boolean runAll;
  +
  +    public static boolean runnigAllTests() { return runAll; }
  +
       public PackageTests()
       {
           super();
  @@ -39,11 +43,11 @@
           suite.addTestSuite(TestAttributes.class);
           suite.addTestSuite(TestEolNormalization.class);
           suite.addTestSuite(TestEntityReplacement.class);
  +        suite.addTestSuite(TestCdsect.class);
           suite.addTestSuite(TestEvent.class);
           suite.addTestSuite(TestToken.class);
           suite.addTestSuite(TestMisc.class);
           suite.addTestSuite(TestSetInput.class);
  -
           suite.addTestSuite(TestSimpleProcessDocdecl.class);
           suite.addTestSuite(TestSimpleValidation.class);
           suite.addTestSuite(TestProcessDocdecl.class);
  @@ -87,8 +91,9 @@
               ex.printStackTrace();
               System.exit(1);
           }
  +        XmlPullParser parser = null;
           try {
  -            f.newPullParser();
  +            parser=f.newPullParser();
           } catch (Exception ex) {
               System.err.println(
                   "ERROR: tests aborted - could not create instance of XmlPullParser from factory "
  @@ -97,8 +102,9 @@
               System.exit(2);
           }
   
  +        XmlSerializer serializer = null;
           try {
  -            f.newSerializer();
  +            serializer=f.newSerializer();
           } catch (Exception ex) {
               System.err.println(
                   "ERROR: tests aborted - could not create instance of XmlSerializer from factory "
  @@ -106,6 +112,12 @@
               ex.printStackTrace();
               System.exit(3);
           }
  +        String name = getClass().getName();
  +        name = name.substring(name.lastIndexOf('.')+1);
  +        System.out.println(name+" uses factory="+f.getClass().getName()
  +                               +" parser="+parser.getClass().getName()
  +                               +" serializer="+serializer.getClass().getName()
  +                          );
   
           // now run all tests ...
           //junit.textui.TestRunner.run(suite());
  @@ -136,6 +148,7 @@
           final String listOfTests = System.getProperty("org.xmlpull.v1.tests");
           final String name = XmlPullParserFactory.PROPERTY_NAME;
           final String oldValue = System.getProperty(name);
  +        runAll = true;
           if(listOfTests != null) {
               int pos = 0;
               while (pos < listOfTests.length()) {
  
  
  
  1.12      +8 -7      xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestEvent.java
  
  Index: TestEvent.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestEvent.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -t -w -r1.11 -r1.12
  --- TestEvent.java	2002/04/24 23:15:02	1.11
  +++ TestEvent.java	2002/09/07 20:39:44	1.12
  @@ -19,23 +19,27 @@
    * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
    */
   public class TestEvent extends UtilTestCase {
  -    private XmlPullParserFactory factory;
  +    public static void main (String[] args) {
  +        junit.textui.TestRunner.run (new TestSuite(TestEvent.class));
  +    }
   
       public TestEvent(String name) {
           super(name);
       }
   
  -    protected void setUp() throws XmlPullParserException {
  -        factory = factoryNewInstance();
  +    protected XmlPullParserFactory newFactory() throws XmlPullParserException {
  +        XmlPullParserFactory factory = factoryNewInstance();
           factory.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
           assertEquals(true, factory.getFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES));
           assertEquals(false, factory.getFeature(XmlPullParser.FEATURE_VALIDATION));
  +        return factory;
       }
   
       protected void tearDown() {
       }
   
       public void testEvent() throws Exception {
  +        XmlPullParserFactory factory = newFactory();
           XmlPullParser xpp = factory.newPullParser();
           xpp.setInput(new StringReader(TEST_XML));
   
  @@ -91,6 +95,7 @@
       }
   
       public void testMultiNs() throws Exception {
  +        XmlPullParserFactory factory = newFactory();
           XmlPullParser xpp = factory.newPullParser();
           xpp.setInput(new StringReader("<foo><bar xmlns=''/><char xmlns=''></char></foo>"));
   
  @@ -129,10 +134,6 @@
           xpp.next();
           checkParserStateNs(xpp, 0, xpp.END_DOCUMENT, null, 0, null, null, null, false, -1);
   
  -    }
  -
  -    public static void main (String[] args) {
  -        junit.textui.TestRunner.run (new TestSuite(TestEvent.class));
       }
   
   }
  
  
  
  1.5       +9 -9      xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSerializeWithNs.java
  
  Index: TestSerializeWithNs.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSerializeWithNs.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -t -w -r1.4 -r1.5
  --- TestSerializeWithNs.java	2002/09/02 20:19:54	1.4
  +++ TestSerializeWithNs.java	2002/09/07 20:39:44	1.5
  @@ -52,7 +52,7 @@
           checkParserStateNs(xpp, 1, xpp.START_TAG, null, 0, "", "foo", null, xpp.isEmptyElementTag() /*empty*/, 0);
           if(textContent != null) {
               xpp.next();
  -            checkParserStateNs(xpp, 1, xpp.TEXT, null, 0, null, null, "test", false, -1);
  +            checkParserStateNs(xpp, 1, xpp.TEXT, null, 0, null, null, textContent, false, -1);
           }
           xpp.next();
           checkParserStateNs(xpp, 1, xpp.END_TAG, null, 0, "", "foo", null, false, -1);
  @@ -164,10 +164,16 @@
       }
   
       public void testMisc() throws Exception {
  -        // all comemnts etc
  +        // all comments etc
       }
   
  -    public void testIndneting() throws Exception {
  +    public void testSetPrefix() throws Exception {
  +        //setPrefix check that prefix is not duplicated ...
  +
  +    //TODO      redeclaring defult namespace
  +    }
  +
  +    public void testIndenting() throws Exception {
           // generate SOAP envelope
           // try to use indentation
   
  @@ -184,12 +190,6 @@
           ser.endDocument();
       }
   
  -    public void testSetPrefix() throws Exception {
  -        //setPrefix check that prefix is not duplicated ...
  -
  -    }
  -
  -    //TODO      redeclaring defult namespace
   
       public void testMultipleOverlappingNamespaces() throws Exception {
           XmlSerializer ser = factory.newSerializer();
  
  
  
  1.13      +14 -6     xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestToken.java
  
  Index: TestToken.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestToken.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -t -w -r1.12 -r1.13
  --- TestToken.java	2002/08/14 13:46:20	1.12
  +++ TestToken.java	2002/09/07 20:39:44	1.13
  @@ -35,6 +35,7 @@
       }
   
       protected void tearDown() {
  +        factory = null;
       }
   
   
  @@ -170,12 +171,19 @@
           } else {
               xpp.nextToken();
           }
  -        checkParserStateNs(xpp, 0, xpp.DOCDECL, null, 0, null, null,
  -                               (roundtripSupported  ? " titlepage "+
  +        checkParserStateNs(xpp, 0, xpp.DOCDECL, null, 0, null, null, false, -1);
  +        String expectedDocdecl = " titlepage "+
                                       //"SYSTEM \"http://www.foo.bar/dtds/typo.dtd\""+
                                       "[<!ENTITY % active.links \"INCLUDE\">"+
  -                                    "  <!ENTITY   test \"This is test! Do NOT Panic!\" >]" : null)
  -                               , false, -1);
  +            "  <!ENTITY   test \"This is test! Do NOT Panic!\" >]";
  +        String gotDocdecl = xpp.getText();
  +        if(roundtripSupported && gotDocdecl == null) {
  +            fail("when roundtrip is enabled DOCDECL content must be reported");
  +        }
  +        if(gotDocdecl != null) {
  +            assertEquals("DOCDECL content", expectedDocdecl, gotDocdecl);
  +        }
  +
           try {
               xpp.isWhitespace();
               fail("whitespace function must fail for DOCDECL");
  
  
  
  1.2       +23 -6     xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestXmlCdsect.java
  
  Index: TestXmlCdsect.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestXmlCdsect.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -t -w -r1.1 -r1.2
  --- TestXmlCdsect.java	2002/07/31 21:32:05	1.1
  +++ TestXmlCdsect.java	2002/09/07 20:39:44	1.2
  @@ -3,10 +3,8 @@
   
   package org.xmlpull.v1.tests;
   
  -import java.io.*;
  -
  +import java.io.IOException;
   import junit.framework.TestSuite;
  -
   import org.xmlpull.v1.XmlPullParserException;
   
   public class TestXmlCdsect extends XmlTestCase {
  @@ -23,6 +21,25 @@
           throws IOException, XmlPullParserException
       {
           testXml("cdsect.xml");
  +    }
  +
  +
  +    public void testCdsectEol()
  +        throws IOException, XmlPullParserException
  +    {
  +        testXml("cdsect_eol.xml");
  +    }
  +
  +    public void testCdsectMixed()
  +        throws IOException, XmlPullParserException
  +    {
  +        testXml("cdsect_mixed.xml");
  +    }
  +
  +    public void testCdsectMore()
  +        throws IOException, XmlPullParserException
  +    {
  +        testXml("cdsect_more.xml");
       }
   
   }
  
  
  
  1.2       +8 -3      xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestXmlSimple.java
  
  Index: TestXmlSimple.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestXmlSimple.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -t -w -r1.1 -r1.2
  --- TestXmlSimple.java	2002/07/31 21:32:05	1.1
  +++ TestXmlSimple.java	2002/09/07 20:39:44	1.2
  @@ -26,5 +26,10 @@
           testXml("simple.xml");
       }
   
  +    public void testSimple2()
  +        throws IOException, XmlPullParserException
  +    {
  +        testXml("simple2.xml");
  +    }
   }
   
  
  
  
  1.17      +21 -4     xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/UtilTestCase.java
  
  Index: UtilTestCase.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/UtilTestCase.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -t -w -r1.16 -r1.17
  --- UtilTestCase.java	2002/08/23 19:11:51	1.16
  +++ UtilTestCase.java	2002/09/07 20:39:44	1.17
  @@ -20,7 +20,8 @@
       protected static final String FEATURE_XML_ROUNDTRIP=
           "http://xmlpull.org/v1/doc/features.html#xml-roundtrip";
   
  -    protected String TEST_XML =
  +
  +    protected final static String TEST_XML =
           "<root>\n"+
           "<foo>bar</foo>\r\n"+
           "<hugo xmlns=\"http://www.xmlpull.org/temp\"> \n\r \n"+
  @@ -32,17 +33,26 @@
           "<!-- an xml sample document without meaningful content -->\n";
   
       //private static XmlPullParserFactory factory;
  +    private static boolean printedFactoryName;
   
       public UtilTestCase(String name) {
           super(name);
       }
   
       public static XmlPullParserFactory factoryNewInstance() throws XmlPullParserException {
  +        String property = System.getProperty(XmlPullParserFactory.PROPERTY_NAME);
  +        //"org.xmlpull.mxp1.MXParserFactory",
  +        //"org.xmlpull.v1.xni2xmlpull1.X2ParserFactory",
  +        //property = "org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer";
           XmlPullParserFactory factory = XmlPullParserFactory.newInstance(
  -            System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
  +            property,
               null //Thread.currentThread().getContextClassLoader().getClass(), //NOT ON JDK 1.1
           );
  -        //System.out.println("factory="+factory);
  +        //System.out.println("factory="+factory+" property="+property);
  +        if(PackageTests.runnigAllTests() == false && printedFactoryName == false) {
  +            System.out.println("factory="+factory+" property="+property);
  +            printedFactoryName = true;
  +        }
           return factory;
       }
   
  @@ -269,7 +279,14 @@
           } else if(ch == '\t') {
               return "\\t";
           } if(ch > 127 || ch < 32) {
  -            return "\\u"+Integer.toHexString((int)ch);
  +            StringBuffer buf = new StringBuffer("\\u");
  +            String hex = Integer.toHexString((int)ch);
  +            for (int i = 0; i < 4-hex.length(); i++)
  +            {
  +                buf.append('0');
  +            }
  +            buf.append(hex);
  +            return buf.toString();
           }
           return ""+ch;
       }
  
  
  
  1.3       +174 -169  xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/XmlTestCase.java
  
  Index: XmlTestCase.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/XmlTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -t -w -r1.2 -r1.3
  --- XmlTestCase.java	2002/08/01 04:45:36	1.2
  +++ XmlTestCase.java	2002/09/07 20:39:44	1.3
  @@ -33,53 +33,49 @@
   
   package org.xmlpull.v1.tests;
   
  -import java.io.*;
  -
  -import junit.framework.TestCase;
  -import junit.framework.TestSuite;
  -
  -import org.xmlpull.v1.*;
  +import java.io.FileInputStream;
  +import java.io.IOException;
  +import java.io.InputStream;
  +import java.io.StringReader;
  +import org.xmlpull.v1.XmlPullParser;
  +import org.xmlpull.v1.XmlPullParserException;
  +import org.xmlpull.v1.XmlPullParserFactory;
   //import org.xmlpull.v1.util.XmlPullWrapper;
   
   //import org.xmlpull.v1.tests.UtilTestCase;
   
   public class XmlTestCase extends UtilTestCase {
       private static final String NS_URI = "http://xmlpull.org/v1/tests/2002-08.xsd";
  -    private static boolean standalone = true;
  -    boolean verbose = false;
  -    XmlPullParser pp;
  -    //XmlPullWrapper wrapper;
  -
  -    XmlPullParserFactory testFactory;
  -    XmlPullParser testParser;
  +    //private static boolean standalone = true;
  +    private static final boolean verbose = false;
   
  +    //public static void main (String[] args) {
  +    //    junit.textui.TestRunner.run (new TestSuite(XmlTestCase.class));
  +    //}
   
  -    public static void main (String[] args) {
  -        junit.textui.TestRunner.run (new TestSuite(XmlTestCase.class));
  -    }
  -
       public XmlTestCase(String name) {
           super(name);
  -        standalone = false;
  +        //standalone = false;
       }
   
       protected void verbose(String msg)
       {
           if(verbose) {
  -            if(standalone) {
  +            if(PackageTests.runnigAllTests()) {
  +                //PackageTests.addNote(msg+"\n");
                   System.out.println(msg);
               } else {
  -                PackageTests.addNote(msg+"\n");
  +                System.out.println(msg);
               }
           }
       }
   
       protected void info(String msg)
       {
  -        if(standalone) {
  -            System.out.println(msg);
  -        } else {
  +        if(PackageTests.runnigAllTests()) {
               PackageTests.addNote(msg+"\n");
  +        } else {
  +            System.out.println(msg);
           }
       }
   
  @@ -113,7 +109,7 @@
           }
   
           if (is == null) {
  -            throw new IOException("could not open stream for "+name);
  +            throw new IOException("could not open XML test for '"+name+"'");
           }
           return is;
       }
  @@ -126,41 +122,49 @@
   
           XmlPullParserFactory factory = factoryNewInstance();
           factory.setNamespaceAware(true);
  -        pp = factory.newPullParser();
  +        //XmlPullWrapper wrapper;
  +
  +
  +        XmlPullParser pp = factory.newPullParser();
           //wrapper = new XmlPullWrapper(pp);
   
  +
           InputStream is = openStream(testName);
           verbose("> LOADING TESTS '"+testName+"'");
           pp.setInput(is, null);
  -        executeTests();
  +        executeTests(pp);
           is.close();
           verbose("< FINISHED TESTS '"+testName+"'");
       }
   
   
  -    protected void executeTests() throws IOException, XmlPullParserException
  +    protected void executeTests(XmlPullParser pp) throws IOException, XmlPullParserException
       {
   
           //wrapper.nextStartTag(NS_URI, "tests");
           pp.nextTag();
           pp.require(pp.START_TAG, NS_URI, "tests");
           while(pp.nextTag() == pp.START_TAG) {
  -            executeTestParser();
  +            executeTestParser(pp);
           }
           pp.require(pp.END_TAG, NS_URI, "tests");
       }
   
  -    protected void executeTestParser() throws IOException, XmlPullParserException
  +    protected void executeTestParser(XmlPullParser pp) throws IOException, XmlPullParserException
       {
           pp.require(pp.START_TAG, NS_URI, "test-parser");
           String testName = pp.getAttributeValue("", "name");
           verbose(">> START TEST '"+testName+"'");
  -        testFactory = XmlPullParserFactory.newInstance();
  +        //testFactory = XmlPullParserFactory.newInstance();
  +        XmlPullParserFactory testFactory = factoryNewInstance();
  +        verbose(">> using testFactory='"+testFactory.getClass()+"'");
  +        XmlPullParser testParser = null;
           boolean testInputReady = false;
           while(pp.nextTag() == pp.START_TAG) {
               String action = pp.getName();
               if("create-parser".equals(action)) {
                   testParser = testFactory.newPullParser();
  +                verbose(">> using testParser='"+testParser.getClass()+"'");
                   pp.nextText();
               } else if("input-inline".equals(action)) {
                   if(testInputReady) {
  @@ -168,6 +172,7 @@
                   }
                   testInputReady = true;
                   String input = pp.nextText();
  +                verbose(">>> "+action+" to '"+printable(input)+"'");
                   verbose(">>> "+action+" to '"+input+"'");
                   testParser.setInput(new StringReader( input ));
               } else if("expect".equals(action)) {
  @@ -181,7 +186,7 @@
                               +(name != null ? " name="+name : "")
                               +(empty != null ? " empty="+empty : ""));
                   if(type != null) {
  -                    int event = convertToEventType(type);
  +                    int event = convertToEventType(pp,type);
                       // comapring string give better error messages
                       assertEquals(pp.TYPES[ event ], pp.TYPES[ testParser.getEventType() ]);
                       // now compare actual int values
  @@ -208,7 +213,7 @@
                   String testText = testParser.nextText();
                   if(text != null) {
                       verbose(">>> "+action+" testParser="+testParser.getPositionDescription());
  -                    assertEquals(printable(text), printable(testText));
  +                    assertEquals(testParser.getPositionDescription(), printable(text), printable(testText));
                       assertEquals(text, testText);
                   }
                   pp.nextText();
  @@ -231,7 +236,7 @@
       }
   
   
  -    private int convertToEventType(String eventName) {
  +    private int convertToEventType(XmlPullParser pp, String eventName) {
           for (int i = 0; i < pp.TYPES.length; i++)
           {
               if( eventName.equals(pp.TYPES[ i ]) ) {
  
  
  
  1.1                  xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestCdsect.java
  
  Index: TestCdsect.java
  ===================================================================
  /* -*-             c-basic-offset: 4; indent-tabs-mode: nil; -*-  //------100-columns-wide------>|*/
  // for license see accompanying LICENSE_TESTS.txt file (available also at http://www.xmlpull.org)
  
  package org.xmlpull.v1.tests;
  
  //import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  import java.io.ByteArrayInputStream;
  import java.io.StringReader;
  
  import org.xmlpull.v1.XmlPullParser;
  import org.xmlpull.v1.XmlPullParserFactory;
  import org.xmlpull.v1.XmlPullParserException;
  
  /**
   * Simple test for CDATA parsing.
   *
   * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
   */
  public class TestCdsect extends UtilTestCase {
      private XmlPullParserFactory factory;
  
      public static void main (String[] args) {
          junit.textui.TestRunner.run (new TestSuite(TestCdsect.class));
      }
  
      public TestCdsect(String name) {
          super(name);
      }
  
      protected void setUp() throws XmlPullParserException {
          factory = factoryNewInstance();
          factory.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
          assertEquals(true, factory.getFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES));
      }
  
      protected void tearDown() {
      }
  
  
      public void testCdsect() throws Exception {
          XmlPullParser xpp = factory.newPullParser();
          assertEquals(true, xpp.getFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES));
  
          final String XML =
              "<t><![CDATA[ f]]>o<![CDATA[o ]]></t>";
  
          xpp.setInput(new StringReader(XML));
          checkParserStateNs(xpp, 0, xpp.START_DOCUMENT, null, 0, null, null, null, false, -1);
          xpp.next();
          checkParserStateNs(xpp, 1, xpp.START_TAG, null, 0, "", "t", null, false/*empty*/, 0);
          xpp.next();
          checkParserStateNs(xpp, 1, xpp.TEXT, null, 0, null, null, " foo ", false, -1);
          xpp.next();
          checkParserStateNs(xpp, 1, xpp.END_TAG, null, 0, "", "t", null, false, -1);
          xpp.next();
          checkParserStateNs(xpp, 0, xpp.END_DOCUMENT, null, 0, null, null, null, false, -1);
      }
  
      public void testCdsectWithEol() throws Exception {
          XmlPullParser xpp = factory.newPullParser();
          assertEquals(true, xpp.getFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES));
  
          final String XML =
              "<t> \n<![CDATA[fo]]>o<![CDATA[ \r\n\r]]>\n</t>";
  
          xpp.setInput(new StringReader(XML));
          checkParserStateNs(xpp, 0, xpp.START_DOCUMENT, null, 0, null, null, null, false, -1);
          xpp.next();
          checkParserStateNs(xpp, 1, xpp.START_TAG, null, 0, "", "t", null, false/*empty*/, 0);
          xpp.next();
          checkParserStateNs(xpp, 1, xpp.TEXT, null, 0, null, null, " \nfoo \n\n\n", false, -1);
          xpp.next();
          checkParserStateNs(xpp, 1, xpp.END_TAG, null, 0, "", "t", null, false, -1);
          xpp.next();
          checkParserStateNs(xpp, 0, xpp.END_DOCUMENT, null, 0, null, null, null, false, -1);
      }
  
  
  
  }
  
  
  
  
  1.2       +0 -64     xmlpull-api-v1/src/xml/tests/cdsect.xml
  
  Index: cdsect.xml
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/xml/tests/cdsect.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -t -w -r1.1 -r1.2
  --- cdsect.xml	2002/07/31 21:33:25	1.1
  +++ cdsect.xml	2002/09/07 20:39:45	1.2
  @@ -24,69 +24,5 @@
   
   
   
  -
  -
  -<!-- now more of complex tests -->
  -
  - <test-parser name="more CDSECT handling">
  -  <create-parser/>
  -  <input-inline>&lt;foo>
  -&lt;t>&lt;![CDATA[ foo]]&gt; &lt;/t>
  -&lt;t>&lt;![CDATA[ foo ]]&gt;&lt;/t>
  -&lt;t> &lt;![CDATA[foo ]]&gt;&lt;/t>
  -&lt;t>&lt;![CDATA[ foo]]&gt; &lt;/t>
  -&lt;t> &lt;![CDATA[foo]]&gt; &lt;/t>
  -&lt;t> &lt;![CDATA[fo]]&gt;&lt;![CDATA[o]]&gt; &lt;/t>
  -&lt;t> &lt;![CDATA[fo]]&gt;o&lt;![CDATA[ ]]&gt;&lt;/t>
  -&lt;t> &lt;![CDATA[f]]&gt;o&lt;![CDATA[o]]&gt; &lt;/t>
  -&lt;t>&lt;![CDATA[ f]]&gt;o&lt;![CDATA[o ]]&gt;&lt;/t>
  -&lt;/foo> </input-inline>
  -  <set-feature>http://xmlpull.org/v1/doc/features.html#process-namespaces</set-feature>
  -  <expect type="START_DOCUMENT"/>
  -  <next/>
  -  <expect type="START_TAG" namespace="" name="foo" empty="false"/>
  -
  -  <next-tag/>
  -  <expect type="START_TAG" namespace="" name="t"/>
  -  <next-text text=" foo "/>
  -
  -  <next-tag/>
  -  <expect type="START_TAG" namespace="" name="t"/>
  -  <next-text text=" foo "/>
  -
  -  <next-tag/>
  -  <expect type="START_TAG" namespace="" name="t"/>
  -  <next-text text=" foo "/>
  -
  -  <next-tag/>
  -  <expect type="START_TAG" namespace="" name="t"/>
  -  <next-text text=" foo "/>
  -
  -  <next-tag/>
  -  <expect type="START_TAG" namespace="" name="t"/>
  -  <next-text text=" foo "/>
  -
  -  <next-tag/>
  -  <expect type="START_TAG" namespace="" name="t"/>
  -  <next-text text=" foo "/>
  -
  -  <next-tag/>
  -  <expect type="START_TAG" namespace="" name="t"/>
  -  <next-text text=" foo "/>
  -
  -  <next-tag/>
  -  <expect type="START_TAG" namespace="" name="t"/>
  -  <next-text text=" foo "/>
  -
  -  <next-tag/>
  -  <expect type="START_TAG" namespace="" name="t"/>
  -  <next-text text=" foo "/>
  -
  -  <next-tag/>
  -  <expect type="END_TAG" namespace="" name="foo" />
  -  <next/>
  -  <expect type="END_DOCUMENT"/>
  - </test-parser>
  -
   </tests>
   
  
  
  
  1.4       +0 -15     xmlpull-api-v1/src/xml/tests/simple.xml
  
  Index: simple.xml
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/xml/tests/simple.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -t -w -r1.3 -r1.4
  --- simple.xml	2002/08/28 04:32:57	1.3
  +++ simple.xml	2002/09/07 20:39:45	1.4
  @@ -7,21 +7,6 @@
     <next-text text="bar"/>
     <next/><expect type="END_DOCUMENT"/>
    </test-parser>
  -
  - <!-- test case derived from possible bug reported by Manoj to xmlpull-user -->
  - <test-parser name="simple test with text content">
  -  <create-parser/> <input-inline>&lt;?xml version="1.0" encoding="utf-8" ?><![CDATA[
  -   <string xmlns="http://whappdev1/bscwebservices/"> &lt;Table&gt;
  -        &lt;ClientID&gt; BS &lt;/ClientID&gt;&gt;/Table&gt;</string> ]]></input-inline>
  -  <set-feature>http://xmlpull.org/v1/doc/features.html#process-namespaces</set-feature>
  -  <expect type="START_DOCUMENT"/>
  -  <next-tag/><expect type="START_TAG" namespace="http://whappdev1/bscwebservices/"
  -                      name="string" empty="false"/>
  -  <next-text text=" &lt;Table>&#10;        &lt;ClientID> BS &lt;/ClientID>>/Table>"/>
  -  <expect type="END_TAG" namespace="http://whappdev1/bscwebservices/" name="string"/>
  -  <next/><expect type="END_DOCUMENT"/>
  - </test-parser>
  -
   </tests>
   
   
  
  
  
  1.1                  xmlpull-api-v1/src/xml/tests/cdsect_eol.xml
  
  Index: cdsect_eol.xml
  ===================================================================
  <tests xmlns="http://xmlpull.org/v1/tests/2002-08.xsd">
  
  <!-- this initial test for CDATA handling -->
   <test-parser name="CDSECT handling">
    <create-parser/>
    <input-inline>&lt;foo>
  &lt;t> &#xA;&lt;![CDATA[fo]]&gt;o&lt;![CDATA[ &#13;&#10;&#13;]]&gt;&#10;&lt;/t>
  &lt;/foo> </input-inline>
    <set-feature>http://xmlpull.org/v1/doc/features.html#process-namespaces</set-feature>
    <expect type="START_DOCUMENT"/>
    <next/>
    <expect type="START_TAG" namespace="" name="foo" empty="false"/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" &#10;foo &#10;&#xa;&#xA;"/>
    <expect type="END_TAG" namespace="" name="t" />
  
    <next-tag/>
    <expect type="END_TAG" namespace="" name="foo" />
    <next/>
    <expect type="END_DOCUMENT"/>
   </test-parser>
  
  </tests>
  
  
  
  1.1                  xmlpull-api-v1/src/xml/tests/cdsect_mixed.xml
  
  Index: cdsect_mixed.xml
  ===================================================================
  <tests xmlns="http://xmlpull.org/v1/tests/2002-08.xsd">
  
  <!-- now more of complex tests -->
  
   <test-parser name="more CDSECT handling">
    <create-parser/>
    <input-inline>&lt;foo>
  <!--                                                                                                   -->
  <!--                                                                                                   -->
  <!--                                                                                                   -->
  <!--                                                                                                   -->
  <!--                                                                                                   -->
  
  &lt;t>&lt;![CDATA[ f]]&gt;o&lt;![CDATA[o ]]&gt;&lt;/t>
  &lt;t> &lt;![CDATA[fo]]&gt;o&lt;![CDATA[ ]]&gt;&lt;/t>
  &lt;t> &lt;![CDATA[f]]&gt;o&lt;![CDATA[o]]&gt; &lt;/t>
  &lt;t>&lt;![CDATA[ f]]&gt;o&lt;![CDATA[o ]]&gt;&lt;/t>
  &lt;/foo> </input-inline>
    <set-feature>http://xmlpull.org/v1/doc/features.html#process-namespaces</set-feature>
    <expect type="START_DOCUMENT"/>
    <next/>
    <expect type="START_TAG" namespace="" name="foo" empty="false"/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="END_TAG" namespace="" name="foo" />
    <next/>
    <expect type="END_DOCUMENT"/>
   </test-parser>
  
  </tests>
  
  
  
  
  1.1                  xmlpull-api-v1/src/xml/tests/cdsect_more.xml
  
  Index: cdsect_more.xml
  ===================================================================
  <tests xmlns="http://xmlpull.org/v1/tests/2002-08.xsd">
  
  <!-- now more of complex tests -->
  
   <test-parser name="more CDSECT handling">
    <create-parser/>
    <input-inline>&lt;foo>
  &lt;t>&lt;![CDATA[ foo]]&gt; &lt;/t>
  &lt;t>&lt;![CDATA[ foo ]]&gt;&lt;/t>
  &lt;t> &lt;![CDATA[foo ]]&gt;&lt;/t>
  &lt;t>&lt;![CDATA[ foo]]&gt; &lt;/t>
  &lt;t> &lt;![CDATA[foo]]&gt; &lt;/t>
  &lt;t> &lt;![CDATA[fo]]&gt;&lt;![CDATA[o]]&gt; &lt;/t>
  &lt;t> &lt;![CDATA[fo]]&gt;o&lt;![CDATA[ ]]&gt;&lt;/t>
  &lt;t> &lt;![CDATA[f]]&gt;o&lt;![CDATA[o]]&gt; &lt;/t>
  &lt;t>&lt;![CDATA[ f]]&gt;o&lt;![CDATA[o ]]&gt;&lt;/t>
  &lt;/foo> </input-inline>
    <set-feature>http://xmlpull.org/v1/doc/features.html#process-namespaces</set-feature>
    <expect type="START_DOCUMENT"/>
    <next/>
    <expect type="START_TAG" namespace="" name="foo" empty="false"/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="START_TAG" namespace="" name="t"/>
    <next-text text=" foo "/>
  
    <next-tag/>
    <expect type="END_TAG" namespace="" name="foo" />
    <next/>
    <expect type="END_DOCUMENT"/>
   </test-parser>
  
  </tests>
  
  
  
  
  1.1                  xmlpull-api-v1/src/xml/tests/simple2.xml
  
  Index: simple2.xml
  ===================================================================
  <tests xmlns="http://xmlpull.org/v1/tests/2002-08.xsd">
   <!-- test case derived from possible bug reported by Manoj to xmlpull-user -->
   <test-parser name="simple test with text content">
    <create-parser/> <input-inline>&lt;?xml version="1.0" encoding="utf-8" ?><![CDATA[
     <string xmlns="http://whappdev1/bscwebservices/"> &lt;Table&gt;
          &lt;ClientID&gt; BS &lt;/ClientID&gt;&gt;/Table&gt;</string> ]]></input-inline>
    <set-feature>http://xmlpull.org/v1/doc/features.html#process-namespaces</set-feature>
    <expect type="START_DOCUMENT"/>
    <next-tag/><expect type="START_TAG" namespace="http://whappdev1/bscwebservices/"
                        name="string" empty="false"/>
    <next-text text=" &lt;Table>&#10;        &lt;ClientID> BS &lt;/ClientID>>/Table>"/>
    <expect type="END_TAG" namespace="http://whappdev1/bscwebservices/" name="string"/>
    <next/><expect type="END_DOCUMENT"/>
   </test-parser>
  </tests>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.