Ted Leung wrote:
> I don't think that XMLPullParserEvent is much use unless it contains data
> that
> the application can use. The object creation I was concerned about was
> creating
> objects to be returned from next().
so what you have in mind is to have XmlStartTag, XmlEndTag and XmlContent to
extend XmlPullParserEvent? and then user code would look like that:
XmlStartTag stag = factory.newStartTag();
XmlEndTag stag = factory.newEndTag();
XmlContent content = factory.newContent();
and now is the problme: how i know what to pass to next(XmlPullParserEvent)
method - it may be start tag or end tag or anthing?
i could have next() to retirn XmlPullParserEvent (like in KXML) but it forces
XPP to create objects even if user does not need them - and there is no way to
plug in my own implementation of start tag (in XPP2 XmlStartTag is just
aninterface and pull parser can work with multiple implementation easily...).
i think that proper solution is to rename XmlPullParserEvent into
XmlPullParserState as it better reflects that it describes pull parser state and
have following methods:
XmlPullParserState next()
XmlPullParserState getCurrentState()
readStartTag(XmlStartTag);
String readContent();
...
this way the user is not forced to read start or end tag when s/he just wants to
skip parts of XML. moreover using String directly instead of XmlContent wrapper
allows for much lightweight parsing - no need to create XmlContent and then to
retrieve actual value (and that is important if i want to have lightweigh XML
node tree that instead of requiring everyting to extend from common Node class
allows to store _any_ Object which is great for creating semi-structured and
typed trees...).
thanks,
alek
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]