Home | History | Annotate | Download | only in net

Lines Matching refs:parser

61             XmlPullParser parser = Xml.newPullParser();
62 parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
63 parser.setInput(in, null);
64 parser.nextTag();
65 return readFeed(parser);
74 * @param parser Incoming XMl
79 private List<Entry> readFeed(XmlPullParser parser)
90 parser.require(XmlPullParser.START_TAG, ns, "feed");
91 while (parser.next() != XmlPullParser.END_TAG) {
92 if (parser.getEventType() != XmlPullParser.START_TAG) {
95 String name = parser.getName();
114 entries.add(readEntry(parser));
116 skip(parser);
126 private Entry readEntry(XmlPullParser parser)
128 parser.require(XmlPullParser.START_TAG, ns, "entry");
134 while (parser.next() != XmlPullParser.END_TAG) {
135 if (parser.getEventType() != XmlPullParser.START_TAG) {
138 String name = parser.getName();
141 id = readTag(parser, TAG_ID);
144 title = readTag(parser, TAG_TITLE);
150 String tempLink = readTag(parser, TAG_LINK);
157 t.parse3339(readTag(parser, TAG_PUBLISHED));
160 skip(parser);
169 private String readTag(XmlPullParser parser, int tagType)
176 return readBasicTag(parser, "id");
178 return readBasicTag(parser, "title");
180 return readBasicTag(parser, "published");
182 return readAlternateLink(parser);
193 * @param parser Current parser object
199 private String readBasicTag(XmlPullParser parser, String tag)
201 parser.require(XmlPullParser.START_TAG, ns, tag);
202 String result = readText(parser);
203 parser.require(XmlPullParser.END_TAG, ns, tag);
210 private String readAlternateLink(XmlPullParser parser)
213 parser.require(XmlPullParser.START_TAG, ns, "link");
214 String tag = parser.getName();
215 String relType = parser.getAttributeValue(null, "rel");
217 link = parser.getAttributeValue(null, "href");
220 if (parser.nextTag() == XmlPullParser.END_TAG) break;
229 private String readText(XmlPullParser parser) throws IOException, XmlPullParserException {
231 if (parser.next() == XmlPullParser.TEXT) {
232 result = parser.getText();
233 parser.nextTag();
239 * Skips tags the parser isn't interested in. Uses depth to handle nested tags. i.e.,
243 private void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
244 if (parser.getEventType() != XmlPullParser.START_TAG) {
249 switch (parser.next()) {