Java Code Examples for org.xmlpull.v1.XmlPullParserException#printStackTrace()
The following examples show how to use
org.xmlpull.v1.XmlPullParserException#printStackTrace() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtomParser.java From PkRSS with Apache License 2.0 | 6 votes |
public AtomParser() { // Initialize DateFormat object with the default date formatting dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US); dateFormat.setTimeZone(Calendar.getInstance().getTimeZone()); pattern = Pattern.compile("-\\d{1,4}x\\d{1,4}"); // Initialize XmlPullParser object with a common configuration XmlPullParser parser = null; try { XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(false); parser = factory.newPullParser(); } catch (XmlPullParserException e) { e.printStackTrace(); } xmlParser = parser; }
Example 2
Source File: Rss2Parser.java From PkRSS with Apache License 2.0 | 6 votes |
public Rss2Parser() { // Initialize DateFormat object with the default date formatting dateFormat = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.US); dateFormat.setTimeZone(Calendar.getInstance().getTimeZone()); pattern = Pattern.compile("-\\d{1,4}x\\d{1,4}"); // Initialize XmlPullParser object with a common configuration XmlPullParser parser = null; try { XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(false); parser = factory.newPullParser(); } catch (XmlPullParserException e) { e.printStackTrace(); } xmlParser = parser; }
Example 3
Source File: OnvifParser.java From ONVIF-Java with Apache License 2.0 | 5 votes |
OnvifParser() { try { xmlFactory = XmlPullParserFactory.newInstance(); xmlFactory.setNamespaceAware(true); xpp = xmlFactory.newPullParser(); } catch (XmlPullParserException e) { e.printStackTrace(); } }
Example 4
Source File: XmlMapsGDataParserFactory.java From mytracks with Apache License 2.0 | 5 votes |
@Override public GDataParser createParser(InputStream is) throws ParseException { is = maybeLogCommunication(is); try { return new XmlGDataParser(is, xmlFactory.createParser()); } catch (XmlPullParserException e) { e.printStackTrace(); return null; } }
Example 5
Source File: XmlMapsGDataParserFactory.java From mytracks with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public GDataParser createParser(Class cls, InputStream is) throws ParseException { is = maybeLogCommunication(is); try { return createParserForClass(cls, is); } catch (XmlPullParserException e) { e.printStackTrace(); return null; } }
Example 6
Source File: XMLResolver.java From Utils with Apache License 2.0 | 5 votes |
public List<XMLNode> readXml(InputStream inputStream) { if (inputStream == null) { return null; } XmlPullParser parser = Xml.newPullParser(); try { parser.setInput(inputStream, "utf-8"); } catch (XmlPullParserException e) { e.printStackTrace(); } return readXml(parser); }
Example 7
Source File: PacketReader.java From AndroidPNClient with Apache License 2.0 | 5 votes |
/** * Resets the parser using the latest connection's reader. Reseting the parser is necessary * when the plain connection has been secured or when a new opening stream element is going * to be sent by the server. */ private void resetParser() { try { parser = XmlPullParserFactory.newInstance().newPullParser(); parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); parser.setInput(connection.reader); } catch (XmlPullParserException xppe) { xppe.printStackTrace(); } }
Example 8
Source File: OSMXmlParser.java From OpenMapKitAndroid with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static OSMDataSet parseFromInputStream(InputStream in) throws IOException { OSMXmlParser osmXmlParser = new OSMXmlParser(); try { osmXmlParser.parse(in); } catch (XmlPullParserException e) { e.printStackTrace(); } finally { if (in != null) { in.close(); } } return osmXmlParser.getDataSet(); }
Example 9
Source File: OSMXmlParserInOSMMapBuilder.java From OpenMapKitAndroid with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static OSMDataSet parseFromInputStream(InputStream in, OSMMapBuilder osmMapBuilder) throws IOException { OSMXmlParser osmXmlParser = new OSMXmlParserInOSMMapBuilder(osmMapBuilder); try { osmXmlParser.parse(in); } catch (XmlPullParserException e) { e.printStackTrace(); } finally { if (in != null) { in.close(); } } return osmXmlParser.getDataSet(); }
Example 10
Source File: WISPAccessGatewayParam.java From WiFiAfterConnect with Apache License 2.0 | 5 votes |
public static WISPAccessGatewayParam parse (InputStream in) throws IOException { try { XmlPullParser parser = Xml.newPullParser(); parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false); parser.setInput(in, null); parser.nextTag(); return parse(parser); } catch (XmlPullParserException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
Example 11
Source File: MultiSelectorDrawableCreator.java From BackgroundLibrary with Apache License 2.0 | 4 votes |
private void addState(StateListDrawable stateListDrawable, int attr) { String value = selectorTa.getString(attr); if(value != null){ String[] vArray = value.split(","); if(vArray.length < 2){ throw new IllegalArgumentException("Attributes and drawable must be set at the same time"); } Drawable drawable = null; int[] attrId = new int[vArray.length - 1]; for (int p = 0; p < vArray.length; p++){ String attrStr = vArray[p]; //取出资源id if(p == vArray.length - 1){ int color = ResourceUtils.getColor(context, attrStr); if(typedArray.getIndexCount() > 0){ try { gradientDrawable = DrawableFactory.getDrawable(typedArray); } catch (XmlPullParserException e) { e.printStackTrace(); } } if(gradientDrawable != null && color != -1){ gradientDrawable.setColor(color); drawable = gradientDrawable; }else { drawable = ResourceUtils.getDrawable(context, attrStr); } if(drawable == null){ throw new IllegalArgumentException("cannot find drawable from the last attribute"); } }else { MultiSelector multiSelector = MultiSelector.getMultiAttr(attrStr.replace("-", "")); if(multiSelector == null){ throw new IllegalArgumentException("the attribute of bl_multi_selector only support " + "state_checkable, state_checked, state_enabled, state_selected, state_pressed, state_focused, " + "state_hovered, state_activated"); } if(attrStr.contains("-")){ attrId[p] = -multiSelector.id; }else { attrId[p] = multiSelector.id; } } } stateListDrawable.addState(attrId, drawable); } }
Example 12
Source File: MultiSelectorDrawableCreator.java From BackgroundLibrary with Apache License 2.0 | 4 votes |
private void addState(StateListDrawable stateListDrawable, int attr) { String value = selectorTa.getString(attr); if(value != null){ String[] vArray = value.split(","); if(vArray.length < 2){ throw new IllegalArgumentException("Attributes and drawable must be set at the same time"); } Drawable drawable = null; int[] attrId = new int[vArray.length - 1]; for (int p = 0; p < vArray.length; p++){ String attrStr = vArray[p]; //取出资源id if(p == vArray.length - 1){ int color = ResourceUtils.getColor(context, attrStr); if(typedArray.getIndexCount() > 0){ try { gradientDrawable = DrawableFactory.getDrawable(typedArray); } catch (XmlPullParserException e) { e.printStackTrace(); } } if(gradientDrawable != null && color != -1){ gradientDrawable.setColor(color); drawable = gradientDrawable; }else { drawable = ResourceUtils.getDrawable(context, attrStr); } if(drawable == null){ throw new IllegalArgumentException("cannot find drawable from the last attribute"); } }else { MultiSelector multiSelector = MultiSelector.getMultiAttr(attrStr.replace("-", "")); if(multiSelector == null){ throw new IllegalArgumentException("the attribute of bl_multi_selector only support " + "state_checkable, state_checked, state_enabled, state_selected, state_pressed, state_focused, " + "state_hovered, state_activated"); } if(attrStr.contains("-")){ attrId[p] = -multiSelector.id; }else { attrId[p] = multiSelector.id; } } } stateListDrawable.addState(attrId, drawable); } }