Java Code Examples for org.xmlpull.v1.XmlPullParser.START_TAG

The following are Jave code examples for showing how to use START_TAG of the org.xmlpull.v1.XmlPullParser class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: VirtualHook   File: VAccountManagerService.java   View Source Code Vote up 7 votes
private void generateServicesMap(List<ResolveInfo> services, Map<String, AuthenticatorInfo> map,
								 IAccountParser accountParser) {
	for (ResolveInfo info : services) {
		XmlResourceParser parser = accountParser.getParser(mContext, info.serviceInfo,
				AccountManager.AUTHENTICATOR_META_DATA_NAME);
		if (parser != null) {
			try {
				AttributeSet attributeSet = Xml.asAttributeSet(parser);
				int type;
				while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
					// Nothing to do
				}
				if (AccountManager.AUTHENTICATOR_ATTRIBUTES_NAME.equals(parser.getName())) {
					AuthenticatorDescription desc = parseAuthenticatorDescription(
							accountParser.getResources(mContext, info.serviceInfo.applicationInfo),
							info.serviceInfo.packageName, attributeSet);
					if (desc != null) {
						map.put(desc.type, new AuthenticatorInfo(desc, info.serviceInfo));
					}
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
 
Example 2
Project: gexporter   File: Gpx2Fit.java   View Source Code Vote up 6 votes
private void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
    if (parser.getEventType() != XmlPullParser.START_TAG) {
        throw new IllegalStateException();
    }
    int depth = 1;
    while (depth != 0) {
        switch (parser.next()) {
            case XmlPullParser.END_TAG:
                depth--;
                break;
            case XmlPullParser.START_TAG:
                depth++;
                break;
        }
    }
}
 
Example 3
Project: FlickLauncher   File: AutoInstallsLayout.java   View Source Code Vote up 6 votes
/**
 * Parses the layout and returns the number of elements added on the homescreen.
 */
protected int parseLayout(int layoutId, ArrayList<Long> screenIds)
        throws XmlPullParserException, IOException {
    XmlResourceParser parser = mSourceRes.getXml(layoutId);
    beginDocument(parser, mRootTag);
    final int depth = parser.getDepth();
    int type;
    HashMap<String, TagParser> tagParserMap = getLayoutElementsMap();
    int count = 0;

    while (((type = parser.next()) != XmlPullParser.END_TAG ||
            parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
        if (type != XmlPullParser.START_TAG) {
            continue;
        }
        count += parseAndAddNode(parser, tagParserMap, screenIds);
    }
    return count;
}
 
Example 4
Project: nativehtml   File: HtmlParser.java   View Source Code Vote up 6 votes
/**
 * Parse the text content of an element.
 * Precondition: behind the opening tag
 * Postcondition: on the closing tag
 */
private void parseTextContentToString(StringBuilder sb) throws IOException, XmlPullParserException {
  while (input.getEventType() != XmlPullParser.END_TAG) {
    switch(input.getEventType()) {
      case XmlPullParser.START_TAG:
        input.next();
        parseTextContentToString(sb);
        input.next();
        break;

      case XmlPullParser.TEXT:
        if (sb != null) {
          sb.append(input.getText());
        }
        input.next();
        break;

      default:
        throw new RuntimeException("Unexpected event: " + input.getPositionDescription());
    }
  }
}
 
Example 5
Project: keepass2android   File: PropfindXmlParser.java   View Source Code Vote up 6 votes
private void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
    android.util.Log.d("PARSE", "skipping " + parser.getName());

    if (parser.getEventType() != XmlPullParser.START_TAG) {
        throw new IllegalStateException();
    }
    int depth = 1;
    while (depth != 0) {
        switch (parser.next()) {
            case XmlPullParser.END_TAG:
                depth--;
                break;
            case XmlPullParser.START_TAG:
                depth++;
                break;
        }
    }
}
 
Example 6
Project: buildAPKsSamples   File: Home.java   View Source Code Vote up 6 votes
private static void beginDocument(XmlPullParser parser, String firstElementName)
        throws XmlPullParserException, IOException {

    int type;
    while ((type = parser.next()) != XmlPullParser.START_TAG &&
            type != XmlPullParser.END_DOCUMENT) {
        // Empty
    }

    if (type != XmlPullParser.START_TAG) {
        throw new XmlPullParserException("No start tag found");
    }

    if (!parser.getName().equals(firstElementName)) {
        throw new XmlPullParserException("Unexpected start tag: found " + parser.getName() +
                ", expected " + firstElementName);
    }
}
 
Example 7
Project: eBread   File: SettingManager.java   View Source Code Vote up 6 votes
/***
 * Public method that read information about theme settings from XML file
 * @param parser                    the current parser used to parse the XML file
 * @return ThemeSetting contains loaded settings
 * @throws XmlPullParserException
 * @throws IOException
 */
private ThemeSetting readThemeSetting(XmlPullParser parser) throws XmlPullParserException, IOException {
    parser.require(XmlPullParser.START_TAG, null, "themesetting");

    ArrayMap<String, String> newValues = new ArrayMap<>();
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();
        if (name.equals("font")) {
            newValues.put("font", readText(parser));
        } else if (name.equals("palette")) {
            newValues.put("palette", readText(parser));
        } else if (name.equals("highlight")) {
            newValues.put("highlight", readText(parser));
        }
    }

    ThemeSetting themesetting = new ThemeSetting();
    themesetting.changeSetting(newValues);
    return themesetting;
}
 
Example 8
Project: TPlayer   File: VContentService.java   View Source Code Vote up 6 votes
private void generateServicesMap(List<ResolveInfo> services, Map<String, SyncAdapterInfo> map,
                                 RegisteredServicesParser accountParser) {
    for (ResolveInfo info : services) {
        XmlResourceParser parser = accountParser.getParser(mContext, info.serviceInfo, "android.content.SyncAdapter");
        if (parser != null) {
            try {
                AttributeSet attributeSet = Xml.asAttributeSet(parser);
                int type;
                while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
                    // Nothing to do
                }
                if ("sync-adapter".equals(parser.getName())) {
                    SyncAdapterType adapterType = parseSyncAdapterType(
                            accountParser.getResources(mContext, info.serviceInfo.applicationInfo), attributeSet);
                    if (adapterType != null) {
                        String key = adapterType.accountType + "/" + adapterType.authority;
                        map.put(key, new SyncAdapterInfo(adapterType, info.serviceInfo));
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 9
Project: Blockly   File: ProcedureInfo.java   View Source Code Vote up 5 votes
public static ProcedureInfo parseImpl(XmlPullParser parser)
        throws BlockLoadingException, IOException, XmlPullParserException {
    List<String> argNames = new ArrayList<>();
    String procedureName = null;
    boolean hasStatementInput = HAS_STATEMENTS_DEFAULT;

    int tokenType = parser.next();
    if (tokenType != XmlPullParser.END_DOCUMENT) {
        parser.require(XmlPullParser.START_TAG, null, Mutator.TAG_MUTATION);

        String attrValue = parser.getAttributeValue(null, ATTR_NAME);
        if (!TextUtils.isEmpty(attrValue)) {
            procedureName = attrValue;
        }

        attrValue = parser.getAttributeValue(null, ATTR_STATEMENTS);
        if (!TextUtils.isEmpty(attrValue)) {
            hasStatementInput = Boolean.getBoolean(attrValue);
        }

        tokenType = parser.next();
        while (tokenType != XmlPullParser.END_DOCUMENT) {
            if (tokenType == XmlPullParser.START_TAG) {
                parser.require(XmlPullParser.START_TAG, null, TAG_ARG);
                String argName = parser.getAttributeValue(null, ATTR_ARG_NAME);
                if (argName == null) {
                    throw new BlockLoadingException(
                            "Function argument #" + argNames.size() + " missing name.");
                }
                argNames.add(argName);
            } else if (tokenType == XmlPullParser.END_TAG
                    && parser.getName().equals(Mutator.TAG_MUTATION)) {
                break;
            }
            tokenType = parser.next();
        }
    }

    return new ProcedureInfo(procedureName, argNames, hasStatementInput);
}
 
Example 10
Project: BookyMcBookface   File: EpubBook.java   View Source Code Vote up 5 votes
private static List<String> getRootFilesFromContainer(BufferedReader containerxml) {

        List<String> rootFiles = new ArrayList<>();

        try {

            containerxml.mark(4);
            if ('\ufeff' != containerxml.read()) containerxml.reset(); // not the BOM marker

            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
            factory.setNamespaceAware(false);
            XmlPullParser xpp = factory.newPullParser();
            xpp.setInput(containerxml);

            int eventType = xpp.getEventType();
            while (eventType != XmlPullParser.END_DOCUMENT) {
                if (eventType == XmlPullParser.START_TAG) {
                    if (xpp.getName().equals("rootfile")) {
                        for (int i = 0; i < xpp.getAttributeCount(); i++) {
                            if (xpp.getAttributeName(i).equals("full-path")) {
                                rootFiles.add(xpp.getAttributeValue(i));
                            }
                        }
                    }

                }
                eventType = xpp.next();
            }
        } catch (Exception e) {
            Log.e("BMBF", "Error parsing xml " + e, e);
        }

        return rootFiles;

    }
 
Example 11
Project: referendum_1o_android   File: StringsManager.java   View Source Code Vote up 5 votes
private static void readStrings(XmlPullParser parser) throws XmlPullParserException, IOException {
    parser.require(XmlPullParser.START_TAG, null, "resources");
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();
        if (name.equals("string")) {
            readString(parser);
        } else {
            skip(parser);
        }
    }
}
 
Example 12
Project: icon_pack_loader   File: IconPackFilterReader.java   View Source Code Vote up 5 votes
protected boolean init(Resources resources) {
    if (isReadDone()) {
        return true;
    }
    if (resources == null) {
        return false;
    }
    int resId = getFilterConfigId();
    XmlResourceParser parser = resources.getXml(resId);
    try {
        int event = parser.getEventType();
        while (event != XmlPullParser.END_DOCUMENT) {
            if (event == XmlPullParser.START_TAG) {
                if (!IconPackConfig.ICONPACKLABEL.equals(parser.getName())) {
                    event = parser.next();
                    continue;
                }
                Intent filter = new Intent();
                String action = parser.getAttributeValue(null,
                        IconPackConfig.ICONPACKACTIONELEMENT);
                if (TextUtils.isEmpty(action)) {
                    event = parser.next();
                    continue;
                }
                filter.setAction(action);
                String category = parser.getAttributeValue(null,
                        IconPackConfig.ICONPACKCATEGORYELEMENT);
                if (TextUtils.isEmpty(category)) {
                    event = parser.next();
                    continue;
                }
                filter.addCategory(category);

                mFilter.add(filter);
            }
            event = parser.next();
        }
        mDone = true;
        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}
 
Example 13
Project: MyFlightbookAndroid   File: GPX.java   View Source Code Vote up 5 votes
public LocSample[] readFeed(XmlPullParser parser) {
    ArrayList<LocSample> lst = new ArrayList<>();

    LocSample sample = null;
    try {
        while (parser.next() != XmlPullParser.END_DOCUMENT) {
            try {
                int eventType = parser.getEventType();
                if (eventType == XmlPullParser.START_TAG) {
                    String name = parser.getName();
                    // Starts by looking for the entry tag
                    switch (name) {
                        case "trkpt":
                            sample = readTrkPoint(parser);
                            break;
                        case "ele":
                            readEle(sample, parser);
                            break;
                        case "time":
                            readTime(sample, parser);
                            break;
                        case "speed":
                            readSpeed(sample, parser);
                            break;
                    }
                } else if (eventType == XmlPullParser.END_TAG) {
                    if (parser.getName().equals("trkpt")) {
                        lst.add(sample);
                        sample = null;
                    }
                }
            }
            catch (XmlPullParserException ignored) { }
        }
    } catch (XmlPullParserException | IOException e) {
        e.printStackTrace();
    }

    return lst.toArray(new LocSample[0]);
}
 
Example 14
Project: healthvault-java-sdk   File: XmlUtils.java   View Source Code Vote up 5 votes
/**
 * Next start tag.
 * 
 * @param parser the parser
 * 
 * @throws XmlPullParserException the xml pull parser exception
 * @throws IOException Signals that an I/O exception has occurred.
 */
public static void nextStartTag(XmlPullParser parser)
    throws XmlPullParserException, IOException
{
    if (parser.nextTag() != XmlPullParser.START_TAG) {
        throw new XmlPullParserException(
            "expected START_TAG but found: " + parser.getPositionDescription());
    }
}
 
Example 15
Project: LaunchEnr   File: IconsManager.java   View Source Code Vote up 5 votes
private void loadAllDrawables(String packageName) {
    mDrawables.clear();
    XmlPullParser xpp;
    try {
        Resources res = mPackageManager.getResourcesForApplication(packageName);
        mCurrentIconPackRes = res;
        int resource = res.getIdentifier("drawable", "xml", packageName);
        if (resource < 0) {
            return;
        }
        xpp = res.getXml(resource);
        int eventType = xpp.getEventType();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            if (eventType == XmlPullParser.START_TAG) {
                if (xpp.getName().equals("item")) {
                    String drawableName = xpp.getAttributeValue(null, "drawable");
                    if (!mDrawables.contains(drawableName) &&
                            getIdentifier(packageName, drawableName, true) > 0) {
                        mDrawables.add(drawableName);
                    }
                }
            }
            eventType = xpp.next();
        }
    } catch (Exception e) {
        e.printStackTrace();
        // fallback onto appfilter if drawable xml fails
        loadIconPack(packageName, true, mContext);
    }
}
 
Example 16
Project: LaunchEnr   File: AutoInstallsLayout.java   View Source Code Vote up 5 votes
@Override
public long parseAndAdd(XmlResourceParser parser)
        throws XmlPullParserException, IOException {
    final String title;
    final int titleResId = getAttributeResourceValue(parser, ATTR_TITLE, 0);
    if (titleResId != 0) {
        title = mSourceRes.getString(titleResId);
    } else {
        title = mContext.getResources().getString(R.string.folder_name);
    }

    mValues.put(Favorites.TITLE, title);
    mValues.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_FOLDER);
    mValues.put(Favorites.SPANX, 1);
    mValues.put(Favorites.SPANY, 1);
    mValues.put(Favorites._ID, mCallback.generateNewItemId());
    long folderId = mCallback.insertAndCheck(mDb, mValues);
    if (folderId < 0) {
        return -1;
    }

    final ContentValues myValues = new ContentValues(mValues);
    ArrayList<Long> folderItems = new ArrayList<Long>();

    int type;
    int folderDepth = parser.getDepth();
    int rank = 0;
    while ((type = parser.next()) != XmlPullParser.END_TAG ||
            parser.getDepth() > folderDepth) {
        if (type != XmlPullParser.START_TAG) {
            continue;
        }
        mValues.clear();
        mValues.put(Favorites.CONTAINER, folderId);
        mValues.put(Favorites.RANK, rank);

        TagParser tagParser = mFolderElements.get(parser.getName());
        if (tagParser != null) {
            final long id = tagParser.parseAndAdd(parser);
            if (id >= 0) {
                folderItems.add(id);
                rank++;
            }
        } else {
            throw new RuntimeException("Invalid folder item " + parser.getName());
        }
    }

    long addedId = folderId;

    // We can only have folders with >= 2 items, so we need to remove the
    // folder and clean up if less than 2 items were included, or some
    // failed to add, and less than 2 were actually added
    if (folderItems.size() < 2) {
        // Delete the folder
        Uri uri = Favorites.getContentUri(folderId);
        SqlArguments args = new SqlArguments(uri, null, null);
        mDb.delete(args.table, args.where, args.args);
        addedId = -1;

        // If we have a single item, promote it to where the folder
        // would have been.
        if (folderItems.size() == 1) {
            final ContentValues childValues = new ContentValues();
            copyInteger(myValues, childValues, Favorites.CONTAINER);
            copyInteger(myValues, childValues, Favorites.SCREEN);
            copyInteger(myValues, childValues, Favorites.CELLX);
            copyInteger(myValues, childValues, Favorites.CELLY);

            addedId = folderItems.get(0);
            mDb.update(Favorites.TABLE_NAME, childValues,
                    Favorites._ID + "=" + addedId, null);
        }
    }
    return addedId;
}
 
Example 17
Project: CSipSimple   File: Utility4.java   View Source Code Vote up 5 votes
/**
 * Attempt to programmatically load the logo from the manifest file of an
 * activity by using an XML pull parser. This should allow us to read the
 * logo attribute regardless of the platform it is being run on.
 *
 * @param activity Activity instance.
 * @return Logo resource ID.
 */
private static int loadLogoFromManifest(Activity activity) {
    int logo = 0;
    try {
        final String thisPackage = activity.getClass().getName();
        if (DEBUG) Log.i(TAG, "Parsing AndroidManifest.xml for " + thisPackage);

        final String packageName = activity.getApplicationInfo().packageName;
        final AssetManager am = activity.createPackageContext(packageName, 0).getAssets();
        final XmlResourceParser xml = am.openXmlResourceParser("AndroidManifest.xml");

        int eventType = xml.getEventType();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            if (eventType == XmlPullParser.START_TAG) {
                String name = xml.getName();

                if ("application".equals(name)) {
                    //Check if the <application> has the attribute
                    if (DEBUG) Log.d(TAG, "Got <application>");

                    for (int i = xml.getAttributeCount() - 1; i >= 0; i--) {
                        if (DEBUG) Log.d(TAG, xml.getAttributeName(i) + ": " + xml.getAttributeValue(i));

                        if ("logo".equals(xml.getAttributeName(i))) {
                            logo = xml.getAttributeResourceValue(i, 0);
                            break; //out of for loop
                        }
                    }
                } else if ("activity".equals(name)) {
                    //Check if the <activity> is us and has the attribute
                    if (DEBUG) Log.d(TAG, "Got <activity>");
                    Integer activityLogo = null;
                    String activityPackage = null;
                    boolean isOurActivity = false;

                    for (int i = xml.getAttributeCount() - 1; i >= 0; i--) {
                        if (DEBUG) Log.d(TAG, xml.getAttributeName(i) + ": " + xml.getAttributeValue(i));

                        //We need both uiOptions and name attributes
                        String attrName = xml.getAttributeName(i);
                        if ("logo".equals(attrName)) {
                            activityLogo = xml.getAttributeResourceValue(i, 0);
                        } else if ("name".equals(attrName)) {
                            activityPackage = ActionBarSherlockCompat.cleanActivityName(packageName, xml.getAttributeValue(i));
                            if (!thisPackage.equals(activityPackage)) {
                                break; //on to the next
                            }
                            isOurActivity = true;
                        }

                        //Make sure we have both attributes before processing
                        if ((activityLogo != null) && (activityPackage != null)) {
                            //Our activity, logo specified, override with our value
                            logo = activityLogo.intValue();
                        }
                    }
                    if (isOurActivity) {
                        //If we matched our activity but it had no logo don't
                        //do any more processing of the manifest
                        break;
                    }
                }
            }
            eventType = xml.nextToken();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (DEBUG) Log.i(TAG, "Returning " + Integer.toHexString(logo));
    return logo;
}
 
Example 18
Project: AIMSICDL   File: StackOverflowXmlParser.java   View Source Code Vote up 5 votes
private Cell readCell(XmlPullParser parser) throws XmlPullParserException, IOException {
    Cell cell = new Cell();
    parser.require(XmlPullParser.START_TAG, ns, "cell");
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();
        switch (name) {
            case "lat":
                cell.setLat(readDouble(parser));
                break;
            case "lon":
                cell.setLon(readDouble(parser));
                break;
            case "mcc":
                cell.setMCC(readInt(parser));
                break;
            case "mnc":
                cell.setMNC(readInt(parser));
                break;
            case "cellid":
                cell.setCID(readInt(parser));
                break;
            case "lac":
                cell.setLAC(readInt(parser));
                break;
            default:
                skip(parser);
                break;
        }
    }
    return cell;
}
 
Example 19
Project: FakeWeather   File: AllLineActivity.java   View Source Code Vote up 4 votes
private List<LPLine> getLPLinesFromXml() throws IOException, XmlPullParserException {
    List<LPLine> list = null;
    LPLine line = null;
    InputStream is = App.getContext().getAssets().open("suzhoubus.xml");
    XmlPullParser xpp = Xml.newPullParser();
    xpp.setInput(is, "UTF-8");
    int eventType = xpp.getEventType();
    while (eventType != XmlPullParser.END_DOCUMENT) {
        switch (eventType) {
            case XmlPullParser.START_DOCUMENT:
                list = new ArrayList<>();
                break;
            case XmlPullParser.START_TAG:
                if (xpp.getName().equals("LPLine")) {
                    line = new LPLine();
                } else if (xpp.getName().equals("LPLineName")) {
                    xpp.next();
                    line.setName(xpp.getText());
                } else if (xpp.getName().equals("LPGUID")) {
                    xpp.next();
                    line.setId(xpp.getText());
                } else if (xpp.getName().equals("LPFStdName")) {
                    xpp.next();
                    line.setFromWhere(xpp.getText());
                } else if (xpp.getName().equals("LPEStdName")) {
                    xpp.next();
                    line.setToWhere(xpp.getText());
                } else if (xpp.getName().equals("LPFStdFTime")) {
                    xpp.next();
                    line.setStartTime(xpp.getText());
                } else if (xpp.getName().equals("LPFStdETime")) {
                    xpp.next();
                    line.setEndTime(xpp.getText());
                } else if (xpp.getName().equals("LPIntervalH")) {
                    xpp.next();
                    line.setMinTime(xpp.getText());
                } else if (xpp.getName().equals("LPIntervalN")) {
                    xpp.next();
                    line.setMaxTime(xpp.getText());
                } else if (xpp.getName().equals("LPDirection")) {
                    xpp.next();
                    line.setDirection(xpp.getText());
                } else if (xpp.getName().equals("LPLineDirect")) {
                    xpp.next();
                    line.setLineDirect(xpp.getText());
                } else if (xpp.getName().equals("LPStandName")) {
                    xpp.next();
                    line.setStations(xpp.getText());
                }
                break;

            case XmlPullParser.END_TAG:
                if (xpp.getName().equals("LPLine")) {
                    list.add(line);
                    line = null;
                }
                break;
        }
        eventType = xpp.next();
    }
    final Collator chineseCollator = Collator.getInstance(Locale.CHINA);
    Collections.sort(list, new Comparator<LPLine>() {
        @Override
        public int compare(LPLine o1, LPLine o2) {
            return chineseCollator.compare(o1.getName(), o2.getName());
        }
    });
    return list;
}
 
Example 20
Project: Ftc2018RelicRecovery   File: FtcSongXml.java   View Source Code Vote up 4 votes
/**
 * This method parses the song in the XML file. The song starts with a song tag and contains one sequence tag
 * and multiple section tags.
 *
 * @throws XmlPullParserException
 * @throws IOException
 */
private TrcSong parseSong() throws XmlPullParserException, IOException
{
    final String funcName = "parseSong";

    if (debugEnabled)
    {
        dbgTrace.traceEnter(funcName, TrcDbgTrace.TraceLevel.FUNC);
    }

    parser.require(XmlPullParser.START_TAG, null, "song");
    TrcSong song = new TrcSong(parser.getAttributeValue(null, "name"));
    while (parser.next() != XmlPullParser.END_TAG)
    {
        //
        // Skip everything until we find the next start tag.
        //
        if (parser.getEventType() != XmlPullParser.START_TAG)
        {
            continue;
        }

        //
        // Check if the start tag is a sequence tag or a section tag. If not, skip the entire tag
        // including the nested tags in it.
        //
        String name = parser.getName();
        if (name.equals("sequence"))
        {
            parseSequence(song);
        }
        else if (name.equals("section"))
        {
            parseSection(song);
        }
        else
        {
            skipTag();
        }
    }
    parser.require(XmlPullParser.END_TAG, null, "song");

    if (debugEnabled)
    {
        dbgTrace.traceExit(funcName, TrcDbgTrace.TraceLevel.FUNC, "=%s", song.toString());
    }

    return song;
}