Android XmlPullParser Search matches(XmlPullParser pp, int type, String namespace, String name)

Here you can find the source of matches(XmlPullParser pp, int type, String namespace, String name)

Description

Tests if the current event is of the given type and if the namespace and name match.

License

Open Source License

Declaration

public static boolean matches(XmlPullParser pp, int type,
        String namespace, String name) throws XmlPullParserException 

Method Source Code

//package com.java2s;
// for license please see accompanying LICENSE.txt file (available also at http://www.xmlpull.org/)

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class Main {
    /**//from w ww  .j  a va2s . c o  m
     * Tests if the current event is of the given type and if the namespace and name match.
     * null will match any namespace and any name. If the test passes a true is returned
     * otherwise a false is returned.
     */
    public static boolean matches(XmlPullParser pp, int type,
            String namespace, String name) throws XmlPullParserException {

        boolean matches = type == pp.getEventType()
                && (namespace == null || namespace
                        .equals(pp.getNamespace()))
                && (name == null || name.equals(pp.getName()));

        return matches;
    }
}

Related

  1. beginDocument(XmlPullParser parser, String firstElementName)
  2. beginDocument(XmlPullParser parser, String firstElementName)
  3. beginDocument(XmlPullParser parser, String firstElementName)
  4. matchNameSpaceUri( XmlPullParser paramXmlPullParser, String paramString)
  5. matches(XmlPullParser pp, int type, String namespace, String name)
  6. test(final XmlPullParser pp, final String tagName)
  7. requireEndDocument(final XmlPullParser pp)
  8. findChildToDepth(XmlPullParser parser, int parentDepth, String namespaceName, String name)