當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。