コード例 #1
0
    /* (non-Javadoc)
     * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
     */
    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException {
      super.startElement(uri, localName, qName, attributes);
      for (DefaultHandler delegate : delegates) {
        delegate.startElement(uri, localName, qName, attributes);
      }
      boolean policy = false;
      if (localName != null && localName.equals(POLICY)) {
        policy = true;
      }
      if (qName != null && qName.endsWith(COLON_POLICY)) {
        policy = true;
      }
      if (!policy) {
        return;
      } else {
        hasPolicy = true;
      }
      int count = attributes.getLength();
      for (int i = 0; i < count; i++) {
        String value = attributes.getValue(i);
        String attrLocalName = attributes.getLocalName(i);
        String attrQName = attributes.getQName(i);

        if ((attrLocalName != null && attrLocalName.equals(ID))
            || (attrLocalName != null && attrQName.endsWith(COLON_ID))) {
          policies.add(attributes.getValue(i));
        }
      }
    }
コード例 #2
0
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   super.startElement(uri, localName, qName, attributes);
   if (localName.equals("repo")) {
     String pk = attributes.getValue("", "pubkey");
     if (pk != null) pubkey = pk;
   } else if (localName.equals("application") && curapp == null) {
     curapp = new DB.App();
     curapp.detail_Populated = true;
     Bundle progressData = createProgressData(repo.address);
     progressCounter++;
     progressListener.onProgress(
         new ProgressListener.Event(
             RepoXMLHandler.PROGRESS_TYPE_PROCESS_XML,
             progressCounter,
             totalAppCount,
             progressData));
   } else if (localName.equals("package") && curapp != null && curapk == null) {
     curapk = new DB.Apk();
     curapk.id = curapp.id;
     curapk.repo = repo.id;
     hashType = null;
   } else if (localName.equals("hash") && curapk != null) {
     hashType = attributes.getValue("", "type");
   }
   curchars.setLength(0);
 }
コード例 #3
0
 /*
  * (non-Javadoc)
  *
  * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String,
  * java.lang.String, java.lang.String, org.xml.sax.Attributes) 元素开始的通知
  */
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   // TODO Auto-generated method stub
   super.startElement(uri, localName, qName, attributes);
   preTag = localName;
 }
コード例 #4
0
  @Override
  public void startElement(String uri, String localName, String name, Attributes attributes)
      throws SAXException {

    if (this.start) {
      if (uri != null) {
        int numAtts = attributes.getLength();

        for (int i = 0; i < numAtts; i++) {
          String attQName = attributes.getQName(i);

          if (attQName.equals("xmlns") || attQName.startsWith("xmlns:")) {
            String attValue = attributes.getValue(i);

            if (uri.equals(attValue)) {
              this.nsSpec = attValue;
              break;
            }
          }
        }
      }

      this.start = false;
    }

    super.startElement(uri, localName, name, attributes);
  }
コード例 #5
0
ファイル: SAXParserHandler.java プロジェクト: zhaoccx/IMOC
 /** 解析xml元素 */
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   // 调用DefaultHandler类的startElement方法
   super.startElement(uri, localName, qName, attributes);
   if (qName.equals("book")) {
     bookIndex++;
     // 创建一个book对象
     book = new Book();
     // 开始解析book元素的属性
     System.out.println("======================开始遍历某一本书的内容=================");
     // //已知book元素下属性的名称,根据属性名称获取属性值
     // String value = attributes.getValue("id");
     // System.out.println("book的属性值是:" + value);
     // 不知道book元素下属性的名称以及个数,如何获取属性名以及属性值
     int num = attributes.getLength();
     for (int i = 0; i < num; i++) {
       System.out.print("book元素的第" + (i + 1) + "个属性名是:" + attributes.getQName(i));
       System.out.println("---属性值是:" + attributes.getValue(i));
       if (attributes.getQName(i).equals("id")) {
         book.setId(attributes.getValue(i));
       }
     }
   } else if (!qName.equals("name") && !qName.equals("bookstore")) {
     System.out.print("节点名是:" + qName + "---");
   }
 }
コード例 #6
0
 /**
  * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String,
  *     java.lang.String, org.xml.sax.Attributes)
  */
 @Override
 public void startElement(
     final String uri, final String localName, final String qName, final Attributes atts)
     throws SAXException {
   // Found the XMI tag
   if (localName.equalsIgnoreCase(XMI_TAG_NAME)) {
     this.processAttributes(atts);
     this.foundXmiStartElement = true;
   }
   // Found the model annotation element
   else if (localName.equalsIgnoreCase(MODEL_ANNOTATION_TAG_NAME)) {
     this.processAttributes(atts);
     this.foundAnnotationStartElement = true;
   }
   // Found the virtual database element
   else if (localName.equalsIgnoreCase(VIRTUAL_DATABASE_TAG_NAME)) {
     this.processVdbAttributes(atts);
     this.foundAnnotationStartElement = true;
     this.foundVdbStartElement = true;
   }
   // Found the models element
   else if (localName.equalsIgnoreCase(MODELS_TAG_NAME) && this.foundVdbStartElement)
     this.processImportAttributes(atts);
   else if (localName.equalsIgnoreCase(MODEL_IMPORT_TAG_NAME)) this.processImportAttributes(atts);
   this.checkForCompletion();
   super.startElement(uri, localName, qName, atts);
 }
コード例 #7
0
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   super.startElement(uri, localName, qName, attributes);
   if ("response".equals(qName)) {
     status = attributes.getValue("status");
   }
 }
コード例 #8
0
  public void startElement(String uri, String localName, String name, Attributes attributes)
      throws SAXException {
    this.tagName = localName;

    if (localName.equals("Weather")) {
      lccinfo = new LifeCurrentCondition();
    }
    super.startElement(uri, localName, name, attributes);
  }
コード例 #9
0
ファイル: XML2Product.java プロジェクト: alannet/example
  @Override
  public void startElement(String uri, String localName, String qName, Attributes attributes)
      throws SAXException {

    if (localName.equals("product")) {
      product = new Product();
    }
    super.startElement(uri, localName, qName, attributes);
  }
コード例 #10
0
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   // TODO Auto-generated method stub
   if (localName.equals("fid")) {
     loginfo = new String[7];
   }
   super.startElement(uri, localName, qName, attributes);
 }
コード例 #11
0
 /** {@inheritDoc} */
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attrs)
     throws SAXException {
   if ("userprofile".equals(qName)) {
     if (attrs.getValue("username") != null) {
       username = attrs.getValue("username");
     }
     if (attrs.getValue("password") != null) {
       password = attrs.getValue("password");
     }
     if (attrs.getValue("apikey") != null) {
       apiKey = attrs.getValue("apikey");
     }
     if (attrs.getValue("localAccount") != null) {
       isLocal = Boolean.parseBoolean(attrs.getValue("localAccount"));
     }
     if (attrs.getValue("superUser") != null) {
       isSuperUser = Boolean.parseBoolean(attrs.getValue("superUser"));
     }
   }
   if ("bags".equals(qName)) {
     savedBags = new LinkedHashMap();
     invalidBags = new LinkedHashMap();
     bagsValues = new LinkedHashMap();
     subHandler =
         new InterMineBagHandler(
             profileManager.getProfileObjectStoreWriter(),
             osw,
             savedBags,
             invalidBags,
             bagsValues);
   }
   if ("shared-bags".equals(qName)) {
     sharedBags = new ArrayList<Map<String, String>>();
     subHandler = new SharedBagHandler(sharedBags);
   }
   if ("template-queries".equals(qName)) {
     savedTemplates = new LinkedHashMap();
     subHandler = new TemplateQueryHandler(savedTemplates, version);
   }
   if ("queries".equals(qName)) {
     savedQueries = new LinkedHashMap();
     subHandler = new SavedQueryHandler(savedQueries, savedBags, version);
   }
   if ("tags".equals(qName)) {
     subHandler = new TagHandler(username, tags);
   }
   if ("preferences".equals(qName)) {
     subHandler = new PreferencesHandler(preferences);
   }
   if ("invitations".equals(qName)) {
     subHandler = invitationHandler;
   }
   if (subHandler != null) {
     subHandler.startElement(uri, localName, qName, attrs);
   }
 }
コード例 #12
0
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   super.startElement(uri, localName, qName, attributes);
   if (localName.equals("book")) {
     emoji = new ChatEmoji();
   }
   builder.setLength(0); // 将字符长度设置为0 以便重新开始读取元素内的字符节点
 }
コード例 #13
0
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   super.startElement(uri, localName, qName, attributes);
   if (qName.equals("customFieldPrototype")) {
     String fieldName = attributes.getValue("name");
     String fieldUrl = attributes.getValue("url");
     fields.add(new Field(fieldName, fieldUrl));
   }
 }
    public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException {
      super.startElement(uri, localName, qName, attributes);

      if (localName.equalsIgnoreCase("result")) {
        //				RegistrationErrorResult result = new RegistrationErrorResult();
        //				result.setType(attributes.getValue("type"));
        res[0] = attributes.getValue("type");
      }
    }
コード例 #15
0
  @Override
  public void startElement(String uri, String localName, String name, Attributes attributes)
      throws SAXException {

    super.startElement(uri, localName, name, attributes);

    if (localName.equals("item")) {
      noticiaActual = new Noticia();
    }
  }
コード例 #16
0
  @Override
  public void startElement(String uri, String localName, String name, Attributes attributes)
      throws SAXException {

    super.startElement(uri, localName, name, attributes);

    if (localName.equals("RESULTS")) {
      dictionary = new Hashtable();
    }
  }
コード例 #17
0
 @Override
 public void startElement(String uri, String localName, String name, Attributes attributes)
     throws SAXException {
   super.startElement(uri, localName, name, attributes);
   if (localName.equalsIgnoreCase("li")) {
     mBuilder.append(" ");
   } else if (localName.equalsIgnoreCase("body")) {
     mInBody = true;
   }
 }
コード例 #18
0
  @Override
  public void startElement(
      final String uri, final String localName, final String name, final Attributes attributes)
      throws SAXException {
    if (localName.equals("Error") || name.equals("Error")) {
      final String errorCode = attributes.getValue("", "errorCode");
      final String severity = attributes.getValue("", "severity");
      final String locationPath = attributes.getValue("", "locationPath");
      final String message = attributes.getValue("", "message");
      this.mErrors.add(new Error(errorCode, severity, locationPath, message));
    }

    this.sb.setLength(0);

    if (localName.equals("XLS")) {
      this.inXLS = true;
    } else if (localName.equals("ResponseHeader")) {
      this.inRepsonseHeader = true;
    } else if (localName.equals("Response")) {
      this.inRepsonse = true;
    } else if (localName.equals("DirectoryResponse")) {
      this.inDirectoryResponse = true;
    } else if (localName.equals("POIContext")) {
      this.inPOIContext = true;
    } else if (localName.equals("POI")) {
      this.inPOI = true;
      this.mCurPOI = new ORSPOI();
      final String poiname = attributes.getValue("", "POIName");
      final String poitype = attributes.getValue("", "description");
      this.mCurPOI.setName(poiname);
      this.mCurPOI.setPOIType(POIType.fromRawName(poitype));
      this.mPOIs.add(this.mCurPOI);
    } else if (localName.equals("Point")) {
      this.inPoint = true;
    } else if (localName.equals("pos")) {
      this.inPos = true;
    } else if (localName.equals("Distance")) {
      this.inDistance = true;
      final String uom = attributes.getValue("", "uom");

      float factor = 0;
      if (uom != null) {
        if (uom.equals("M")) {
          factor = 1;
        } else if (uom.equals("KM")) {
          factor = 1000;
        }
      }

      this.mCurPOI.setDistance((int) (factor * Float.parseFloat(attributes.getValue("", "value"))));
    } else {
      Log.w(DEBUGTAG, "Unexpected tag: '" + name + "'");
    }
    super.startElement(uri, localName, name, attributes);
  }
コード例 #19
0
ファイル: XmlNamespaceFinder.java プロジェクト: kym81/fuse
  @Override
  public void startElement(String uri, String localName, String qName, Attributes attributes)
      throws SAXException {
    super.startElement(uri, localName, qName, attributes);

    if (!namespaceFound) {
      if (uri != null && uri.length() > 0) {
        namespaces.add(uri);
      }
    }
  }
コード例 #20
0
    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException {
      super.startElement(uri, localName, qName, attributes);

      LogUtils.i("uri=" + uri + "/localName=" + localName + "/qName=" + qName);
      if (localName.equals("string")) {
        book = new Weather();
      }
      // builder.setLength(0); // 将字符长度设置为0 以便重新开始读取元素内的字符节点
    }
コード例 #21
0
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   super.startElement(uri, localName, qName, attributes);
   if (qName.equals("customFieldPrototype")) {
     field.type = attributes.getValue("type");
   }
   if (qName.equals("defaultParam") && attributes.getValue("name").equals("defaultBundle")) {
     field.defaultBundle = attributes.getValue("value");
   }
 }
コード例 #22
0
  @Override
  public void startElement(String uri, String localName, String qName, Attributes attributes)
      throws SAXException {
    super.startElement(uri, localName, qName, attributes);

    if (qName.equalsIgnoreCase(DATA_TAG)) {
      String date = attributes.getValue(DATA_DATE_ATTR);
      int live_hours = Integer.parseInt(attributes.getValue(DATA_LIVE_ATTR));
      parseDate(date, live_hours);
    }
  }
コード例 #23
0
    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException {
      super.startElement(uri, localName, qName, attributes);
      if (qName != null && qName.length() > 0) localName = qName;
      level++;
      L.d(tab() + "<" + localName + ">");
      currentAttributes = attributes;
      elements.push(localName);
      // String currentElement = elements.peek();
      if (!insideFeed && "feed".equals(localName)) {
        insideFeed = true;
      } else if ("entry".equals(localName)) {
        if (!insideFeed) {
          insideFeed = true;
          singleEntry = true;
        }
        insideEntry = true;
        entryInfo = new EntryInfo();
      } else if ("category".equals(localName)) {
        if (insideEntry) {
          String category = attributes.getValue("label");
          if (category != null) entryInfo.categories.add(category);
        }
      } else if ("id".equals(localName)) {

      } else if ("updated".equals(localName)) {

      } else if ("title".equals(localName)) {

      } else if ("link".equals(localName)) {
        LinkInfo link = new LinkInfo(url, attributes);
        if (link.isValid() && insideFeed) {
          L.d(tab() + link.toString());
          if (insideEntry) {
            if (link.type != null) {
              entryInfo.links.add(link);
              int priority = link.getPriority();
              if (link.type.startsWith("application/atom+xml")) {
                entryInfo.link = link;
              } else if (priority > 0
                  && (entryInfo.link == null || entryInfo.link.getPriority() < priority)) {
                entryInfo.link = link;
              }
            }
          } else {
            if ("self".equals(link.rel)) docInfo.selfLink = link;
            else if ("alternate".equals(link.rel)) docInfo.alternateLink = link;
          }
        }
      } else if ("author".equals(localName)) {
        authorInfo = new AuthorInfo();
      }
    }
コード例 #24
0
ファイル: MyHandler.java プロジェクト: kirtov/lesson6
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attr)
     throws SAXException {
   super.startElement(uri, localName, qName, attr);
   TAGS nowType = type.get(qName);
   if (nowType == null) return;
   if (nowType == TAGS.ITEM) {
     tagEntry = true;
   } else {
     sb.setLength(0);
   }
 }
コード例 #25
0
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   super.startElement(uri, localName, qName, attributes);
   thisElement = localName;
   // Log.i("startElement",localName);
   switch (thisElement) {
     case YAHOO_LOCATION:
       if (attributes != null) {
         _yahooWeatherForecast.setCityName(attributes.getValue(ATTR_CITY));
         _yahooWeatherForecast.setRegionName(attributes.getValue(ATTR_REGION));
         _yahooWeatherForecast.setCountryName(attributes.getValue(ATTR_COUNTRY));
       }
       break;
     case YAHOO_ASTRONOMY:
       if (attributes != null) {
         _yahooWeatherForecast.setSunriseTime(attributes.getValue(ATTR_SUNRISE));
         _yahooWeatherForecast.setSunsetTime(attributes.getValue(ATTR_SUNSET));
       }
       break;
     case YAHOO_ATMOSPHERE:
       if (attributes != null) {
         _yahooWeatherForecast.setHumidity(attributes.getValue(ATTR_HUMIDITY));
         _yahooWeatherForecast.setPressure(attributes.getValue(ATTR_PRESS));
       }
       break;
     case YAHOO_UNITS:
       if (attributes != null) {
         _yahooWeatherForecast.setTempUnit(attributes.getValue(ATTR_TEMP));
         _yahooWeatherForecast.setDistUnit(attributes.getValue(ATTR_DIST));
         _yahooWeatherForecast.setPressUnit(attributes.getValue(ATTR_PRESS));
         _yahooWeatherForecast.setSpeedUnit(attributes.getValue(ATTR_SPEED));
       }
       break;
     case YAHOO_WIND:
       if (attributes != null) {
         _yahooWeatherForecast.setWindSpeed(attributes.getValue(ATTR_SPEED));
       }
       break;
     case YAHOO_FORECAST:
       if (attributes != null) {
         YahooSimpleForecast simpleForecast = new YahooSimpleForecast();
         simpleForecast.setDay(attributes.getValue(ATTR_DAY));
         simpleForecast.setDate(attributes.getValue(ATTR_DATE));
         simpleForecast.setLowTemp(attributes.getValue(ATTR_LOW_TEMP));
         simpleForecast.setHighTemp(attributes.getValue(ATTR_HIGH_TEMP));
         simpleForecast.setCondition(attributes.getValue(ATTR_CONDITION));
         _yahooWeatherForecast.addForecast(simpleForecast);
       }
       break;
   }
 }
コード例 #26
0
    public void startElement(String pUri, String pLocalName, String pName, Attributes pAttributes)
        throws SAXException {
      super.startElement(pUri, pLocalName, pName, pAttributes);
      // System.out.print("[ " + pName + ", ");
      // for (int i = 0; i < pAttributes.getLength(); ++i) {
      // System.out.print(pAttributes.getLocalName(i) + "="
      // + pAttributes.getValue(i));
      // }
      // System.out.println("]");
      ElementTypes defaultHandlerType;
      if (mElementMap.containsKey(pName)) {
        defaultHandlerType = (ElementTypes) mElementMap.get(pName);
      } else {
        throw new IllegalArgumentException("Element " + pName + " is not matched.");
      }
      XsdHandler nextHandler = null;
      switch (defaultHandlerType.getId()) {
        case Element_Id:
          nextHandler = createElementHandler();
          break;
        case ComplexType_Id:
          nextHandler = new ComplexTypeHandler(this);
          break;
        case ComplexContent_Id:
          nextHandler = new ComplexContentHandler(this);
          break;
        case Schema_Id:
          nextHandler = new SchemaHandler(this);
          break;

        case Sequence_Id:
          nextHandler = new SequenceHandler(this);
          break;
        case Choice_Id:
          nextHandler = new ChoiceHandler(this);
          break;
        case Extension_Id:
          nextHandler = new ExtensionHandler(this);
          break;
        case Attribute_Id:
          nextHandler = new AttributeHandler(this);
          break;
        case Group_Id:
          nextHandler = new GroupHandler(this);
          break;
        default:
          nextHandler = new XsdHandler(this);
          // throw new IllegalArgumentException("Wrong type " + pName);
      }
      mCurrentHandler = nextHandler;
      nextHandler.startElement(pName, pAttributes);
    }
コード例 #27
0
  @Override
  public void startElement(String uri, String localName, String name, Attributes attributes)
      throws SAXException {
    if (localName.equalsIgnoreCase(MAP)) {
      if (mRendererInfo != null) {
        if (attributes.getValue(ID).equalsIgnoreCase(mMapId)) {
          mRendererInfo.ID = attributes.getValue(ID);
          mRendererInfo.NAME = attributes.getValue(NAME);
          mRendererInfo.BASEURL = attributes.getValue(BASEURL);
          mRendererInfo.ZOOM_MINLEVEL = Integer.parseInt(attributes.getValue(ZOOM_MINLEVEL));
          mRendererInfo.ZOOM_MAXLEVEL = Integer.parseInt(attributes.getValue(ZOOM_MAXLEVEL));
          mRendererInfo.IMAGE_FILENAMEENDING = attributes.getValue(IMAGE_FILENAMEENDING);
          mRendererInfo.MAPTILE_SIZEPX = Integer.parseInt(attributes.getValue(MAPTILE_SIZEPX));
          mRendererInfo.URL_BUILDER_TYPE = Integer.parseInt(attributes.getValue(URL_BUILDER_TYPE));
          mRendererInfo.TILE_SOURCE_TYPE = Integer.parseInt(attributes.getValue(TILE_SOURCE_TYPE));
          mRendererInfo.PROJECTION = Integer.parseInt(attributes.getValue(PROJECTION));
          mRendererInfo.YANDEX_TRAFFIC_ON =
              Integer.parseInt(attributes.getValue(YANDEX_TRAFFIC_ON));

          mRendererInfo.LAYER = false;
          if (attributes.getIndex(LAYER) > -1)
            mRendererInfo.LAYER = Boolean.parseBoolean(attributes.getValue(LAYER));

          mRendererInfo.CACHE = "";
          if (attributes.getIndex(CACHE) > -1) mRendererInfo.CACHE = attributes.getValue(CACHE);
        }
      } else if (mSubmenu != null) {
        final int i = attributes.getIndex(LAYER);
        if (mSharedPreferences.getBoolean(
                MainPreferences.PREF_PREDEFMAPS_ + attributes.getValue(ID), true)
            && (i == -1 || !attributes.getValue(LAYER).equalsIgnoreCase(TRUE))) {
          final MenuItem item = mSubmenu.add(attributes.getValue(NAME));
          item.setTitleCondensed(attributes.getValue(ID));
        }
      } else if (mPrefMapsgroup != null) {
        final int i = attributes.getIndex(LAYER);
        if (i == -1 || !attributes.getValue(LAYER).equalsIgnoreCase(TRUE)) {
          CheckBoxPreference pref = new CheckBoxPreference(mPrefActivity);
          pref.setKey(MainPreferences.PREF_PREDEFMAPS_ + attributes.getValue(ID));
          pref.setTitle(attributes.getValue(NAME));
          pref.setSummary(attributes.getValue(DESCR));
          // [email protected]  this does set the pref on the pref page to not checked, but
          // cancels out any effect of behavior (they still show up, and checking them changes
          // nothing)
          pref.setDefaultValue(true);
          mPrefMapsgroup.addPreference(pref);
        }
      }
    }
    super.startElement(uri, localName, name, attributes);
  }
コード例 #28
0
 @Override
 public void startElement(String uri, String localName, String name, Attributes attributes)
     throws SAXException {
   String label, id, parent_id;
   super.startElement(uri, localName, name, attributes);
   if (localName.equalsIgnoreCase("General")) {
     String grisbiFileVersion = attributes.getValue("File_version");
     if (!checkFileVersion(grisbiFileVersion)) {
       throw new FileVersionNotSupportedException(grisbiFileVersion);
     }
   } else if (localName.equals(mainElementName6)) {
     label = attributes.getValue(nameAttributeName6);
     id = attributes.getValue("Nb");
     if (label != null && id != null) {
       catTree.add(label, Integer.parseInt(id), 0);
     }
   } else if (localName.equals(subElementName6)) {
     label = attributes.getValue(nameAttributeName6);
     id = attributes.getValue("Nb");
     parent_id = attributes.getValue("Nbc");
     if (label != null && id != null && parent_id != null) {
       catTree.add(label, Integer.parseInt(id), Integer.parseInt(parent_id));
     }
   } else if (localName.equals(mainElementName5)) {
     label = attributes.getValue(nameAttributeName5);
     id = attributes.getValue("No");
     if (label != null && id != null) {
       currentMainCategorieId = Integer.parseInt(id);
       catTree.add(label, currentMainCategorieId, 0);
     }
   } else if (localName.equals(subElementName5)) {
     label = attributes.getValue(nameAttributeName5);
     id = attributes.getValue("No");
     if (label != null && id != null) {
       catTree.add(label, Integer.parseInt(id), currentMainCategorieId);
     }
   } else if (localName.equals(partiesElementName6)) {
     label = attributes.getValue(nameAttributeName6);
     if (label != null) {
       partiesList.add(label);
     }
   } else if (localName.equals(partiesElementName5)) {
     label = attributes.getValue(nameAttributeName5);
     if (label != null) {
       partiesList.add(label);
     }
   }
   builder.setLength(0);
 }
コード例 #29
0
  /**
   * Starts an element.
   *
   * @param namespaceURI the namespace.
   * @param localName the element name.
   * @param qName the element name.
   * @param atts the element attributes.
   * @throws SAXException for errors.
   */
  @Override
  public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
      throws SAXException {

    DefaultHandler current = getCurrentHandler();
    if (current != this) {
      current.startElement(namespaceURI, localName, qName, atts);
    } else if (qName.equals(PIEDATASET_TAG)) {
      this.dataset = new DefaultPieDataset();
    } else if (qName.equals(ITEM_TAG)) {
      ItemHandler subhandler = new ItemHandler(this, this);
      getSubHandlers().push(subhandler);
      subhandler.startElement(namespaceURI, localName, qName, atts);
    }
  }
コード例 #30
0
 @Override
 public void startElement(String uri, String localName, String qName, Attributes attributes)
     throws SAXException {
   super.startElement(uri, localName, qName, attributes);
   if (qName.equals(BALISE_TR)) {
     alertCourante = new Alert();
   }
   if (qName.equals(BALISE_TD) && TD_LIGNE.equals(attributes.getValue(ATTRIBUT_CLASS))) {
     ligneEncours = true;
   }
   if (qName.equals(BALISE_A)) {
     alertCourante.url = attributes.getValue(ATTRIBUT_HREF);
   }
   contenu.setLength(0);
 }