Java 类org.jivesoftware.smack.provider.PacketExtensionProvider 实例源码

项目:EIM    文件:PEPProvider.java   
/**
 * Parses a PEPEvent packet and extracts a PEPItem from it.
 * (There is only one per <event>.)
 *
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {

    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals("event")) {
            } else if (parser.getName().equals("items")) {
                // Figure out the node for this event.
                String node = parser.getAttributeValue("", "node");
                // Get the parser for this kind of node, and if found then parse the node.
                PacketExtensionProvider nodeParser = nodeParsers.get(node);
                if (nodeParser != null) {
                    pepItem = nodeParser.parseExtension(parser);
                }
             }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals("event")) {
                done = true;
            }
        }
    }

    return pepItem;
}
项目:androidPN-client.    文件:PEPProvider.java   
/**
 * Parses a PEPEvent packet and extracts a PEPItem from it.
 * (There is only one per <event>.)
 *
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {

    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals("event")) {
            } else if (parser.getName().equals("items")) {
                // Figure out the node for this event.
                String node = parser.getAttributeValue("", "node");
                // Get the parser for this kind of node, and if found then parse the node.
                PacketExtensionProvider nodeParser = nodeParsers.get(node);
                if (nodeParser != null) {
                    pepItem = nodeParser.parseExtension(parser);
                }
             }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals("event")) {
                done = true;
            }
        }
    }

    return pepItem;
}
项目:java-bells    文件:PEPProvider.java   
/**
 * Parses a PEPEvent packet and extracts a PEPItem from it.
 * (There is only one per <event>.)
 *
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {

    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals("event")) {
            } else if (parser.getName().equals("items")) {
                // Figure out the node for this event.
                String node = parser.getAttributeValue("", "node");
                // Get the parser for this kind of node, and if found then parse the node.
                PacketExtensionProvider nodeParser = nodeParsers.get(node);
                if (nodeParser != null) {
                    pepItem = nodeParser.parseExtension(parser);
                }
             }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals("event")) {
                done = true;
            }
        }
    }

    return pepItem;
}
项目:telegraph    文件:PEPProvider.java   
/**
 * Parses a PEPEvent packet and extracts a PEPItem from it.
 * (There is only one per <event>.)
 *
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {

    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals("event")) {
            } else if (parser.getName().equals("items")) {
                // Figure out the node for this event.
                String node = parser.getAttributeValue("", "node");
                // Get the parser for this kind of node, and if found then parse the node.
                PacketExtensionProvider nodeParser = nodeParsers.get(node);
                if (nodeParser != null) {
                    pepItem = nodeParser.parseExtension(parser);
                }
             }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals("event")) {
                done = true;
            }
        }
    }

    return pepItem;
}
项目:NewCommunication-Android    文件:PEPProvider.java   
/**
 * Parses a PEPEvent packet and extracts a PEPItem from it.
 * (There is only one per <event>.)
 *
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {

    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals("event")) {
            } else if (parser.getName().equals("items")) {
                // Figure out the node for this event.
                String node = parser.getAttributeValue("", "node");
                // Get the parser for this kind of node, and if found then parse the node.
                PacketExtensionProvider nodeParser = nodeParsers.get(node);
                if (nodeParser != null) {
                    pepItem = nodeParser.parseExtension(parser);
                }
             }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals("event")) {
                done = true;
            }
        }
    }

    return pepItem;
}
项目:fcmxmppserver    文件:CcsClient.java   
private CcsClient() {
    // Add FcmPacketExtension
    ProviderManager.getInstance().addExtensionProvider(Util.FCM_ELEMENT_NAME, Util.FCM_NAMESPACE,
            new PacketExtensionProvider() {

                @Override
                public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
                    String json = parser.nextText();
                    FcmPacketExtension packet = new FcmPacketExtension(json);
                    return packet;
                }
            });
}
项目:xmppsupport_v2    文件:PEPProvider.java   
/**
 * Parses a PEPEvent packet and extracts a PEPItem from it. (There is only
 * one per <event>.)
 * 
 * @param parser
 *            the XML parser, positioned at the starting element of the
 *            extension.
 * @return a PacketExtension.
 * @throws Exception
 *             if a parsing error occurs.
 */
public PacketExtension parseExtension(XmlPullParser parser)
        throws Exception {

    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals("event")) {
            } else if (parser.getName().equals("items")) {
                // Figure out the node for this event.
                String node = parser.getAttributeValue("", "node");
                // Get the parser for this kind of node, and if found then
                // parse the node.
                PacketExtensionProvider nodeParser = nodeParsers.get(node);
                if (nodeParser != null) {
                    pepItem = nodeParser.parseExtension(parser);
                }
            }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals("event")) {
                done = true;
            }
        }
    }

    return pepItem;
}
项目:gcm_server    文件:CcsClient.java   
private CcsClient() {
    // Add GcmPacketExtension
    ProviderManager.getInstance().addExtensionProvider(GCM_ELEMENT_NAME,
            GCM_NAMESPACE, new PacketExtensionProvider() {

                @Override
                public PacketExtension parseExtension(XmlPullParser parser)
                throws Exception {
                    String json = parser.nextText();
                    GcmPacketExtension packet = new GcmPacketExtension(json);
                    return packet;
                }
            });
}
项目:maven-yaxim    文件:XmppStreamHandler.java   
private static void addSimplePacketExtension(final String name, final String namespace) {
    ProviderManager.getInstance().addExtensionProvider(name, namespace,
            new PacketExtensionProvider() {
                public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
                    StreamHandlingPacket packet = new StreamHandlingPacket(name, namespace);
                    int attributeCount = parser.getAttributeCount();
                    for (int i = 0; i < attributeCount; i++) {
                        packet.addAttribute(parser.getAttributeName(i),
                            parser.getAttributeValue(i));
                    }
                    return packet;
                }
            });
}
项目:prive-android    文件:XmppStreamHandler.java   
private static void addSimplePacketExtension(final String name, final String namespace) {
    ProviderManager.getInstance().addExtensionProvider(name, namespace,
            new PacketExtensionProvider() {
                public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
                    StreamHandlingPacket packet = new StreamHandlingPacket(name, namespace);
                    int attributeCount = parser.getAttributeCount();
                    for (int i = 0; i < attributeCount; i++) {
                        packet.addAttribute(parser.getAttributeName(i),
                                parser.getAttributeValue(i));
                    }
                    return packet;
                }
            });
}
项目:EIM    文件:PacketParserUtils.java   
/**
 * Parses a packet extension sub-packet.
 *
 * @param elementName the XML element name of the packet extension.
 * @param namespace the XML namespace of the packet extension.
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser)
        throws Exception
{
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider)provider).parseExtension(parser);
        }
        else if (provider instanceof Class) {
            return (PacketExtension)parseWithIntrospection(
                    elementName, (Class)provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name,"");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}
项目:EIM    文件:PEPProvider.java   
public void registerPEPParserExtension(String node, PacketExtensionProvider pepItemParser) {
    nodeParsers.put(node, pepItemParser);
}
项目:androidpn_enhanced_client    文件:PacketParserUtils.java   
/**
 * Parses a packet extension sub-packet.
 *
 * @param elementName the XML element name of the packet extension.
 * @param namespace the XML namespace of the packet extension.
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser)
        throws Exception
{
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider)provider).parseExtension(parser);
        }
        else if (provider instanceof Class) {
            return (PacketExtension)parseWithIntrospection(
                    elementName, (Class)provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name,"");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}
项目:androidPN-client.    文件:PacketParserUtils.java   
/**
 * Parses a packet extension sub-packet.
 *
 * @param elementName the XML element name of the packet extension.
 * @param namespace the XML namespace of the packet extension.
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser)
        throws Exception
{
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider)provider).parseExtension(parser);
        }
        else if (provider instanceof Class) {
            return (PacketExtension)parseWithIntrospection(
                    elementName, (Class<?>)provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name,"");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}
项目:androidPN-client.    文件:PEPProvider.java   
public void registerPEPParserExtension(String node, PacketExtensionProvider pepItemParser) {
    nodeParsers.put(node, pepItemParser);
}
项目:xmppsupport_v2    文件:PacketParserUtils.java   
/**
 * Parses a packet extension sub-packet.
 * 
 * @param elementName
 *            the XML element name of the packet extension.
 * @param namespace
 *            the XML namespace of the packet extension.
 * @param parser
 *            the XML parser, positioned at the starting element of the
 *            extension.
 * @return a PacketExtension.
 * @throws Exception
 *             if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName,
        String namespace, XmlPullParser parser) throws Exception {
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(
            elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider) provider)
                    .parseExtension(parser);
        } else if (provider instanceof Class) {
            return (PacketExtension) parseWithIntrospection(elementName,
                    (Class) provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(
            elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name, "");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}
项目:xmppsupport_v2    文件:PEPProvider.java   
public void registerPEPParserExtension(String node,
        PacketExtensionProvider pepItemParser) {
    nodeParsers.put(node, pepItemParser);
}
项目:AndroidPNClient    文件:PacketParserUtils.java   
/**
 * Parses a packet extension sub-packet.
 *
 * @param elementName the XML element name of the packet extension.
 * @param namespace the XML namespace of the packet extension.
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser)
        throws Exception
{
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider)provider).parseExtension(parser);
        }
        else if (provider instanceof Class) {
            return (PacketExtension)parseWithIntrospection(
                    elementName, (Class)provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name,"");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}
项目:java-bells    文件:PacketParserUtils.java   
/**
 * Parses a packet extension sub-packet.
 *
 * @param elementName the XML element name of the packet extension.
 * @param namespace the XML namespace of the packet extension.
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser)
        throws Exception
{
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider)provider).parseExtension(parser);
        }
        else if (provider instanceof Class) {
            return (PacketExtension)parseWithIntrospection(
                    elementName, (Class<?>)provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name,"");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}
项目:java-bells    文件:PEPProvider.java   
public void registerPEPParserExtension(String node, PacketExtensionProvider pepItemParser) {
    nodeParsers.put(node, pepItemParser);
}
项目:telegraph    文件:PacketParserUtils.java   
/**
 * Parses a packet extension sub-packet.
 *
 * @param elementName the XML element name of the packet extension.
 * @param namespace the XML namespace of the packet extension.
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser)
        throws Exception
{
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider)provider).parseExtension(parser);
        }
        else if (provider instanceof Class) {
            return (PacketExtension)parseWithIntrospection(
                    elementName, (Class)provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name,"");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}
项目:telegraph    文件:PEPProvider.java   
public void registerPEPParserExtension(String node, PacketExtensionProvider pepItemParser) {
    nodeParsers.put(node, pepItemParser);
}
项目:NewCommunication-Android    文件:PacketParserUtils.java   
/**
 * Parses a packet extension sub-packet.
 *
 * @param elementName the XML element name of the packet extension.
 * @param namespace the XML namespace of the packet extension.
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser)
        throws Exception
{
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider)provider).parseExtension(parser);
        }
        else if (provider instanceof Class) {
            return (PacketExtension)parseWithIntrospection(
                    elementName, (Class)provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name,"");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}
项目:NewCommunication-Android    文件:PEPProvider.java   
public void registerPEPParserExtension(String node, PacketExtensionProvider pepItemParser) {
    nodeParsers.put(node, pepItemParser);
}
项目:asmack-mini    文件:PacketParserUtils.java   
/**
 * Parses a packet extension sub-packet.
 *
 * @param elementName the XML element name of the packet extension.
 * @param namespace the XML namespace of the packet extension.
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser)
        throws Exception
{
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider)provider).parseExtension(parser);
        }
        else if (provider instanceof Class) {
            return (PacketExtension)parseWithIntrospection(
                    elementName, (Class<?>)provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name,"");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}