示例#1
0
  private void ReadXmlStreamed(InputStream readerStream) throws IOException, InvalidDBException {

    try {
      ReadDocumentStreamed(CreatePullParser(readerStream));
    } catch (XmlPullParserException e) {
      e.printStackTrace();
      throw new IOException(e.getLocalizedMessage());
    }
  }
示例#2
0
 public static void logEvent(final XmlPullParser xpp) {
   if (LOGGER.isLoggable(Level.FINEST)) {
     try {
       int eventType = xpp.getEventType();
       if (eventType == XmlPullParser.END_DOCUMENT) {
         LOGGER.finest("Received: END_DOCUMENT event");
         return;
       }
       if ("message".equals(xpp.getName())) { // message is handled specially
         return;
       }
       if (xpp.getName() == null) {
         LOGGER.warning("Unexpected type: (" + Util.getType(xpp) + ") encountered in logEvent");
         return;
       }
       StringBuilder toXml = new StringBuilder();
       if (eventType == XmlPullParser.TEXT) {
         return;
       }
       toXml.append("<");
       if (eventType == XmlPullParser.END_TAG) {
         toXml.append('/');
       }
       toXml.append(xpp.getName());
       for (int i = 0; i < xpp.getAttributeCount(); i++) {
         toXml
             .append(' ')
             .append(xpp.getAttributeName(i))
             .append("='")
             .append(xpp.getAttributeValue(i))
             .append("'");
       }
       toXml.append('>');
       LOGGER.finest("Received: " + toXml.toString());
     } catch (XmlPullParserException ex) {
       LOGGER.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
     }
   }
 }