当前位置: 首页>>代码示例>>Java>>正文


Java XmlPullParserFactory.setValidating方法代码示例

本文整理汇总了Java中org.xmlpull.v1.XmlPullParserFactory.setValidating方法的典型用法代码示例。如果您正苦于以下问题:Java XmlPullParserFactory.setValidating方法的具体用法?Java XmlPullParserFactory.setValidating怎么用?Java XmlPullParserFactory.setValidating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xmlpull.v1.XmlPullParserFactory的用法示例。


在下文中一共展示了XmlPullParserFactory.setValidating方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.xmlpull.v1.XmlPullParserFactory; //导入方法依赖的package包/类
Podcasts parse(InputStream input, @Nullable String charset, String baseUri) throws IOException {
    try {
        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setValidating(false);

        XmlPullParser xpp = factory.newPullParser();
        xpp.setInput(input, charset);

        int eventType = xpp.getEventType();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            if (eventType == XmlPullParser.START_TAG) {
                String tag = xpp.getName();
                if (LayoutUtils.isDiv(tag) && hasClass(xpp, PODCAST_LIST_CLASS)) {
                    return parsePodcasts(xpp, NetworkUtils.toOptURI(baseUri));
                }
            }
            eventType = lenientNext(xpp);
        }
        return new Podcasts();
    } catch (XmlPullParserException e) {
        throw new IOException(e);
    }
}
 
开发者ID:kalikov,项目名称:lighthouse,代码行数:25,代码来源:PodcastsLayoutParser.java

示例2: getXmlPullParser

import org.xmlpull.v1.XmlPullParserFactory; //导入方法依赖的package包/类
/**
 * Gets a XmlPullParser for use in parsing incoming messages.
 *
 * @return parser instance
 */
private static XmlPullParser getXmlPullParser() {
    SoftReference<XmlPullParser> ref = XPP_PARSER.get();
    XmlPullParser result = ref.get();
    if (result == null) {
        Exception thrown;
        try {
            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
            factory.setNamespaceAware(true);
            factory.setValidating(false);
            result = factory.newPullParser();
            ref = new SoftReference<XmlPullParser>(result);
            XPP_PARSER.set(ref);
            return result;
        } catch (Exception ex) {
            thrown = ex;
        }
        throw(new IllegalStateException(
                "Could not create XmlPull parser", thrown));
    } else {
        return result;
    }
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:28,代码来源:BodyParserXmlPull.java

示例3: DisplayLayout

import org.xmlpull.v1.XmlPullParserFactory; //导入方法依赖的package包/类
public DisplayLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    try {
        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setValidating(false);
    } catch (XmlPullParserException e) {
        Log.e(TAG, "Error creating XmlPullParserFactory", e);
    }

    TypedArray ta = context.obtainStyledAttributes(
            attrs,
            R.styleable.DisplayLayout
    );

    String presentationName = AppState.getInstance().getPresentationName();
    if (presentationName != null) {
        Log.v(TAG, "Presentation: " + presentationName);
        int id = getResources().getIdentifier(presentationName, "array", context.getPackageName());
        Log.v(TAG, "id: " + id);
        if (id > 0) {
            String[] slideNames = getResources().getStringArray(id);
            Log.v(TAG, "slideNames: " + Arrays.toString(slideNames));
            slides.addAll(Arrays.asList(slideNames));
        }
        for (String slide : slides) {
            Log.v(TAG, "Slide: " + slide);
        }
    }

    inAnim = ta.getResourceId(R.styleable.DisplayLayout_inAnimation, -1);
    outAnim = ta.getResourceId(R.styleable.DisplayLayout_outAnimation, -1);

    ta.recycle();

}
 
开发者ID:StylingAndroid,项目名称:PresenterLite,代码行数:37,代码来源:DisplayLayout.java

示例4: getAttrs

import org.xmlpull.v1.XmlPullParserFactory; //导入方法依赖的package包/类
public static AttributeSet getAttrs(InputStream inputStream, String tagName, Map<String, String> customAttrs) {
    try {
        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setValidating(true);
        XmlPullParser parser = factory.newPullParser();
        parser.setInput(inputStream, "UTF-8");

        return getAttrs(parser, tagName, customAttrs);
    } catch (XmlPullParserException e) {
        e.printStackTrace();
    }

    return null;
}
 
开发者ID:kaiyangjia,项目名称:EasyForm-Android,代码行数:15,代码来源:XMLUtils.java

示例5: createXmlSerializer

import org.xmlpull.v1.XmlPullParserFactory; //导入方法依赖的package包/类
public static XmlSerializer createXmlSerializer(Writer out) {
	XmlSerializer result = null;
	try {
		XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
		factory.setValidating(true);
		result = factory.newSerializer();
		result.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
		result.setOutput(out);
	} catch (Exception e) {
		log.error("When creating XmlSerializer: " + e.getClass().getName() + ": " + e.getMessage());
	}
	return result;
}
 
开发者ID:finanzer,项目名称:epubfx,代码行数:14,代码来源:EpubProcessorSupport.java


注:本文中的org.xmlpull.v1.XmlPullParserFactory.setValidating方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。