[Bug 177] New: make XPP3 cloneable

[email protected] Fri, 6 Feb 2004 19:06:37 -0500 (EST)
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=177

           Summary: make XPP3 cloneable
           Product: xpp3-java
           Version: 1.1.3
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P4
         Component: impl-mxp1
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Nathaniel Hughes wrote:

>So I'm having one slight problem using my cloned pull parser and I was 
>wondering if someone could help. Here's what I'm doing:
>
>I'm parsing a file, and at a certain point in the file, I clone my parser 
>(I actually do this multiple times) and store it. Then at a later point, I 
>retrieve that parser and begin parsing again. Well, I'm cloning my parser 
>like this:
>
>   do {
>        if(eventType == XmlPullParser.START_DOCUMENT) {
>            System.out.println("Start document");
>        } else if(eventType == XmlPullParser.END_DOCUMENT) {
>            System.out.println("End document");
>        } else if(eventType == XmlPullParser.START_TAG) {
>          ...
>	 if(//time to clone) {
>	   try {
>	     clonedParser = (CloneableMXParser) xpp.clone();
>	   }
>	   catch (CloneNotSupportedException e) {
>	     e.printStackTrace();
>	   }
>	   parserVec.add(clonedParser);
>	}
>            processStartElement(xpp);
>        } else if(eventType == XmlPullParser.END_TAG) {
>            processEndElement(xpp);
>          } else if(eventType == XmlPullParser.TEXT) {
>            processText(xpp);
>        }
>        eventType = xpp.next();
>    } while (eventType != XmlPullParser.END_DOCUMENT);
>
>
>When I try to begin parsing with my cloned parser again (running through 
>the same loop), I get this error (top of the stack trace here):
>
>java.io.EOFException: no more data available - expected end tags
</TAGTWO></TAGONE> to close start tag <TAGTWO> from line 43 and start tag
<TAGONE> from line 3, parser stopped on TEXT seen ... blah="366" blah2="34"
blah3="this" blah4="2065" ... @43:162
>	at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2987)
>	at org.xmlpull.mxp1.MXParser.more(MXParser.java:2996)
>	at org.xmlpull.mxp1.MXParser.parseStartTag(MXParser.java:1769)
>	at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1126)
>	at org.xmlpull.mxp1.MXParser.next(MXParser.java:1092)
>	at com.watchguard.tests.PullParser.processDocument(PullParser.java:129)
>
>The parser starts parsing alright, it processes the first start, end and 
>text elements it pulls, but then, when it does a next and recieves the 
>next start tag, it throws this error.
>
>The depth at this point is 1 (which it should be) and the elRawName 
>contains both the TAGONE and TAGTWO char arrays, but TAGONE is the only 
>one that is still open, so this shouldn't be an issue.
>
>Hope this makes a little sense, any help would be great!
>



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


 
Yahoo! Groups Links

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

<*> 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/