CVS Update: xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests
Aleksander Andrzej Slominski <[email protected]> Sat, 3 May 2003 01:37:46 -0500 (EST)
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <[email protected]> |
aslom 03/05/03 01:37:46
Modified: src/java/api/org/xmlpull/v1 XmlPullParser.java
src/java/samples XmlPullCount.java
src/java/tests/org/xmlpull/v1/tests TestMisc.java
TestSerializeWithNs.java TestSetInput.java
TestToken.java
Log:
small clarification to XmlPullParser javadoc
updated XmlPullCOunt sample
fixed tests source code formatting
Revision Changes Path
1.75 +2 -0 xmlpull-api-v1/src/java/api/org/xmlpull/v1/XmlPullParser.java
Index: XmlPullParser.java
===================================================================
RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/api/org/xmlpull/v1/XmlPullParser.java,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -t -w -r1.74 -r1.75
--- XmlPullParser.java 9 Feb 2003 00:38:28 -0000 1.74
+++ XmlPullParser.java 3 May 2003 06:37:45 -0000 1.75
@@ -498,6 +498,8 @@
* (http://xmlpull.org/v1/doc/features.html#detect-encoding),
* it must return the detected encoding.
* If setInput(Reader) was called, null is returned.
+ * After first call to next if XML declaration was present this method
+ * will return encoding declared.
*/
public String getInputEncoding();
1.3 +11 -13 xmlpull-api-v1/src/java/samples/XmlPullCount.java
Index: XmlPullCount.java
===================================================================
RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/samples/XmlPullCount.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -t -w -r1.2 -r1.3
--- XmlPullCount.java 18 Feb 2003 19:48:11 -0000 1.2
+++ XmlPullCount.java 3 May 2003 06:37:45 -0000 1.3
@@ -39,32 +39,32 @@
XmlPullParserFactory factory = XmlPullParserFactory.newInstance(
System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
factory.setNamespaceAware(true);
- System.out.println("using factory "+factory.getClass());
+ System.err.println("using factory "+factory.getClass());
XmlPullParser xpp = factory.newPullParser();
- System.out.println("using parser "+xpp.getClass());
+ System.err.println("using parser "+xpp.getClass());
XmlPullCount app = new XmlPullCount();
for(int c = 0; c < 2; ++c) {
- System.out.println("run#"+c);
+ System.err.println("run#"+c);
app.resetCounters();
if(args.length == 0) {
- System.out.println("Parsing simple sample XML length="+SAMPLE_XML.length());
+ System.err.println("Parsing simple sample XML length="+SAMPLE_XML.length());
xpp.setInput( new StringReader( SAMPLE_XML ) );
app.countXml(xpp);
} else {
//r (int i = 0; i < args.length; i++) {
File f = new File(args[0]);
- System.out.println("Parsing file: "+args[0]+" length="+f.length());
+ System.err.println("Parsing file: "+args[0]+" length="+f.length());
xpp.setInput ( new FileReader ( args [0] ) );
app.countXml(xpp);
//
}
app.printReport();
}
- System.out.println("finished");
+ System.err.println("finished");
}
public void resetCounters() {
@@ -72,7 +72,7 @@
}
public void printReport() {
- System.out.println("characters="+countChars
+ System.err.println("characters="+countChars
+" elements="+countSTags
+" attributes="+countAttribs);
@@ -82,13 +82,11 @@
int holderForStartAndLength[] = new int[2];
-
- int eventType = xpp.getEventType();
- if(eventType == XmlPullParser.START_DOCUMENT) {
- eventType = xpp.next();
- }
+ xpp.require(XmlPullParser.START_DOCUMENT, null, null);
+ int eventType = xpp.next();
+ xpp.require(XmlPullParser.START_TAG, null, null);
while (eventType != XmlPullParser.END_DOCUMENT) {
- //System.out.println("pos="+xpp.getPositionDescription());
+ //System.err.println("pos="+xpp.getPositionDescription());
if(eventType == XmlPullParser.START_TAG) {
++countSTags;
countAttribs += xpp.getAttributeCount();
1.17 +1 -1 xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestMisc.java
Index: TestMisc.java
===================================================================
RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestMisc.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -t -w -r1.16 -r1.17
1.16 +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.15
retrieving revision 1.16
diff -u -b -t -w -r1.15 -r1.16
1.7 +1 -1 xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSetInput.java
Index: TestSetInput.java
===================================================================
RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSetInput.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -t -w -r1.6 -r1.7
1.17 +1 -1 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.16
retrieving revision 1.17
diff -u -b -t -w -r1.16 -r1.17
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/KXUxcA/fNtFAA/uetFAA/2U_rlB/TM
---------------------------------------------------------------------~->
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/