CVS Update: xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests

Aleksander Andrzej Slominski <[email protected]> Sun, 22 Oct 2006 23:36:08 -0400 (EDT)
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
aslom       06/10/22 23:36:08

  Modified:    .        build.xml
               src/java/samples CloneParser.java Roundtrip.java
               src/java/tests/org/xmlpull/v1/tests TestSerializeWithNs.java
  Log:
  minor updates
  
  Revision  Changes    Path
  1.32      +2 -2      xmlpull-api-v1/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/build.xml,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -b -t -w -r1.31 -r1.32
  --- build.xml	28 Feb 2005 20:18:29 -0000	1.31
  +++ build.xml	23 Oct 2006 03:36:08 -0000	1.32
  @@ -10,8 +10,8 @@
     <!-- set global properties for this build -->
   
     <property name="name" value="XmlPull"/>
  -  <property name="year" value="2005"/>
  -  <property name="version" value="1_1_3_4b"/>
  +  <property name="year" value="2006"/>
  +  <property name="version" value="1_1_3_4c"/>
     <property name="xmlpull_version" value="xmlpull_${version}"/>
     <property name="xmlpull_tag" value="XMLPULL_${version}"/>
     <property name="copyright"
  
  
  
  1.3       +1 -0      xmlpull-api-v1/src/java/samples/CloneParser.java
  
  Index: CloneParser.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/samples/CloneParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -t -w -r1.2 -r1.3
  --- CloneParser.java	13 Feb 2004 21:26:25 -0000	1.2
  +++ CloneParser.java	23 Oct 2006 03:36:08 -0000	1.3
  @@ -24,6 +24,7 @@
           {
               CloenableCharArrayReader cloned = (CloenableCharArrayReader) super.clone();
               cloned.buf = (char[]) buf.clone();
  +            //cloned.buf = buf.clone();
               //UGLY UGLY UGLY ...
               cloned.lock = cloned;
               return cloned;
  
  
  
  1.12      +69 -29    xmlpull-api-v1/src/java/samples/Roundtrip.java
  
  Index: Roundtrip.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/samples/Roundtrip.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -t -w -r1.11 -r1.12
  --- Roundtrip.java	19 May 2003 14:43:03 -0000	1.11
  +++ Roundtrip.java	23 Oct 2006 03:36:08 -0000	1.12
  @@ -18,10 +18,11 @@
    */
   
   public class Roundtrip {
  -    //private static final String FEATURE_XML_ROUNDTRIP=
  -    //    "http://xmlpull.org/v1/doc/features.html#xml-roundtrip";
  +    
       private final static String PROPERTY_XMLDECL_STANDALONE =
           "http://xmlpull.org/v1/doc/features.html#xmldecl-standalone";
  +    private final static String PROPERTY_SERIALIZER_INDENTATION =
  +        "http://xmlpull.org/v1/doc/properties.html#serializer-indentation";
   
       private XmlPullParser parser;
       private XmlSerializer serializer;
  @@ -116,23 +117,62 @@
           writeToken (XmlPullParser.END_DOCUMENT);
       }
   
  -
  -    public static void main(String[] args) throws Exception {
  -        //for (int i = 0; i < args.length; i++)
  +    private static void roundTrip(Reader reader, Writer writer, String indent)
  +        throws XmlPullParserException, IOException
  +    {
           XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
           factory.setNamespaceAware(true);
  -        for (int i = 0; i < 1; i++)
  +        XmlPullParser pp = factory.newPullParser();
  +        pp.setInput(reader);
  +        XmlSerializer serializer = factory.newSerializer();
  +        serializer.setOutput( writer );
  +        if(indent != null) {
  +            serializer.setProperty(PROPERTY_SERIALIZER_INDENTATION, indent);
  +        }
  +        (new Roundtrip(pp, serializer)).roundTrip();
  +        
  +    }
  +
  +    
  +//    public static void main(String[] args) throws Exception {
  +//        String XML = "<test><foo>fdf</foo></test>";
  +//        Reader r = new StringReader(XML);
  +//        Writer w = new StringWriter();
  +//        roundTrip(r, w, "  ");
  +//        System.out.println("indented XML="+w);
  +//    }
  +    
  +    private static void roundTrip(XmlPullParserFactory factory, String loc)
  +        throws XmlPullParserException, IOException
  +    {
  +        roundTrip(factory, loc, null);
  +    }
  +    
  +    private static void roundTrip(XmlPullParserFactory factory, String loc, String indent)
  +        throws XmlPullParserException, IOException
           {
               XmlPullParser pp = factory.newPullParser();
  -            pp.setInput(new java.net.URL(args[ i ]).openStream(), null);
  +        pp.setInput(new java.net.URL(loc).openStream(), null);
   
               XmlSerializer serializer = factory.newSerializer();
               serializer.setOutput( System.out, null);
  -
  +        if(indent != null) {
  +            serializer.setProperty(PROPERTY_SERIALIZER_INDENTATION, indent);
  +        }
               (new Roundtrip(pp, serializer)).roundTrip();
           }
  +    
  +    public static void main(String[] args) throws Exception {
  +      //for (int i = 0; i < args.length; i++)
  +        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
  +        factory.setNamespaceAware(true);
  +        for (int i = 0; i < 1; i++)
  +        {
  +            roundTrip(factory, args[i], "  ");
  +        }
       }
   
  +    
   }
   
   
  
  
  
  1.23      +1 -1      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.22
  retrieving revision 1.23
  diff -u -b -t -w -r1.22 -r1.23
  --- TestSerializeWithNs.java	22 Apr 2006 22:46:20 -0000	1.22
  +++ TestSerializeWithNs.java	23 Oct 2006 03:36:08 -0000	1.23
  @@ -685,7 +685,6 @@
           ser.endDocument();
           
           String serialized = sw.toString();
  -        //System.err.println(getClass()+" sw="+sw);
           xpp.setInput(new StringReader(serialized));
           
           checkParserStateNs(xpp, 0, XmlPullParser.START_DOCUMENT, null, 0, null, null, null, false, -1);
  @@ -695,6 +694,7 @@
           int nsCount = 1;
           if(extraPrefix) ++nsCount;
           if(expectedPrefix == null) ++nsCount;
  +        //System.err.println(getClass()+" nsCount="+nsCount+" extraPrefix="+extraPrefix+" expectedPrefix="+expectedPrefix+" sw="+sw);
           checkParserStateNs(xpp, 1, XmlPullParser.START_TAG, expectedPrefix, nsCount, NS, "foo", null, xpp.isEmptyElementTag() /*empty*/, 1);
           checkAttribNs(xpp, 0, NS, "attr", "aar");
       }
  
  
  



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/xmlpull-dev/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/xmlpull-dev/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/