Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2011 MadRobot. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * Elton Kent - initial API and implementation ******************************************************************************/ import java.io.InputStream; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import android.util.AttributeSet; import android.util.Xml; public class Main { /** * Get the xml as a AttributeSet * * @param is XML InputStream * @return AttributeSet representation of the xml stream * @throws XmlPullParserException */ public static AttributeSet getAttributeSet(InputStream is) throws XmlPullParserException { XmlPullParser parser = Xml.newPullParser(); parser.setInput(is, null); AttributeSet set = Xml.asAttributeSet(parser); return set; } }