Package org.jdom

Examples of org.jdom.Attribute


    category.setName(element.getText());

    /* Interpret Attributes */
    List< ? > categoryAttributes = element.getAttributes();
    for (Iterator< ? > iter = categoryAttributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName().toLowerCase();

      /* Check wether this Attribute is to be processed by a Contribution */
      if (processAttributeExtern(attribute, category))
        continue;

      /* Domain */
      else if ("domain".equals(name)) //$NON-NLS-1$
        category.setDomain(attribute.getValue());
    }
  }
View Full Code Here


    IAttachment attachment = Owl.getModelFactory().createAttachment(null, news);

    /* Interpret Attributes */
    List< ? > attachmentAttributes = element.getAttributes();
    for (Iterator< ? > iter = attachmentAttributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName().toLowerCase();

      /* Check wether this Attribute is to be processed by a Contribution */
      if (processAttributeExtern(attribute, attachment))
        continue;

      /* URL */
      else if ("url".equals(name)) {//$NON-NLS-1$
        URI uri = URIUtils.createURI(attribute.getValue());
        if (uri != null)
          attachment.setLink(uri);
      }

      /* Type */
      else if ("type".equals(name)) //$NON-NLS-1$
        attachment.setType(attribute.getValue());

      /* Length */
      else if ("length".equals(name)) {//$NON-NLS-1$
        int length = StringUtils.stringToInt(attribute.getValue());
        if (length >= 0)
          attachment.setLength(length);
      }
    }
  }
View Full Code Here

    processNamespaceAttributes(element, source);

    /* Interpret Attributes */
    List< ? > attributes = element.getAttributes();
    for (Iterator< ? > iter = attributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName().toLowerCase();

      /* Check wether this Attribute is to be processed by a Contribution */
      if (processAttributeExtern(attribute, source))
        continue;

      /* URL */
      else if ("url".equals(name)) { //$NON-NLS-1$
        URI uri = URIUtils.createURI(attribute.getValue());
        if (uri != null)
          source.setLink(uri);
      }
    }
  }
View Full Code Here

    Boolean permaLink = null;
    /* Interpret Attributes */
    List< ? > attributes = element.getAttributes();
    for (Iterator< ? > iter = attributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName().toLowerCase();

//      /* Check whether this Attribute is to be processed by a Contribution */
//      if (processAttributeExtern(attribute, guid))
//        continue;

      /* Is Permalink */
      if ("ispermalink".equals(name)) //$NON-NLS-1$
        permaLink = Boolean.parseBoolean(attribute.getValue());
    }
    Owl.getModelFactory().createGuid(news, element.getText(), permaLink);
  }
View Full Code Here

  private void processFeed(Element element, IFeed feed) {

    /* Interpret Attributes */
    List< ? > attributes = element.getAttributes();
    for (Iterator< ? > iter = attributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName();

      /* Check wether this Attribute is to be processed by a Contribution */
      if (processAttributeExtern(attribute, feed))
        continue;

      /* Version */
      else if ("version".equals(name)) //$NON-NLS-1$
        feed.setFormat(buildFormat("Atom", attribute.getValue())); //$NON-NLS-1$

      /* Language */
      else if ("lang".equals(name)) //$NON-NLS-1$
        feed.setLanguage(attribute.getValue());
    }

    /* Interpret Children */
    List< ? > channelChildren = element.getChildren();
    for (Iterator< ? > iter = channelChildren.iterator(); iter.hasNext();) {
View Full Code Here

    ICategory category = Owl.getModelFactory().createCategory(null, type);

    /* Interpret Attributes */
    List< ? > categoryAttributes = element.getAttributes();
    for (Iterator< ? > iter = categoryAttributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName().toLowerCase();

      /* Check wether this Attribute is to be processed by a Contribution */
      if (processAttributeExtern(attribute, category))
        continue;

      /* Term */
      else if ("term".equals(name)) {//$NON-NLS-1$
        category.setDomain(attribute.getValue());

        /* Use as Name if not yet set */
        if (category.getName() == null)
          category.setName(attribute.getValue());
      }

      /* Label */
      else if ("label".equals(name)) //$NON-NLS-1$
        category.setName(attribute.getValue());
    }
  }
View Full Code Here

    news.setBase(feed.getBase());

    /* Interpret Attributes */
    List<?> itemAttributes = element.getAttributes();
    for (Iterator<?> iter = itemAttributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName().toLowerCase();

      /* Check wether this Attribute is to be processed by a Contribution */
      if (processAttributeExtern(attribute, news))
        continue;

      /* About */
      else if ("about".equals(name)) //$NON-NLS-1$
        Owl.getModelFactory().createGuid(news, attribute.getValue(), true);
    }

    /* Interpret Children */
    List<?> newsChilds = element.getChildren();
    for (Iterator<?> iter = newsChilds.iterator(); iter.hasNext();) {
View Full Code Here

        pollingIntervalInSeconds =
                Integer.parseInt(componentConfig.getChild(POLLING_INTERVAL).getTextTrim());
        List<Element> paramElements = componentConfig.getChildren(PARAM);
        for(Element param: paramElements){
            String mbean = param.getAttribute(MBEAN).getValue();
            Attribute representsWhole = param.getAttribute(REP_WHOLE);
            String attribute = representsWhole != null ?
                param.getAttribute(ATTRIBUTE).getValue() + "|" + representsWhole.getValue() :
                  param.getAttribute(ATTRIBUTE).getValue();
            String attribDisplayName = param.getAttribute(DISPLAY_NAME).getValue();

            if(!mbeans.contains(mbean))
                mbeans.add(mbean);
View Full Code Here

                                             rssVersion + "].");
      }
    } else if (rootElement.indexOf("rdf") >= 0) {
      return RSS_1_0_Parser.getInstance().parse(cBuilder, root);
    } else if (rootElement.indexOf("feed") >= 0) {
      Attribute versionAttr = root.getAttribute("version");
      Namespace namespace = ParserUtils.getDefaultNS(root);
      if (versionAttr != null) {
          String feedVersion = versionAttr.getValue();
          if (feedVersion.indexOf("0.1") >= 0 || feedVersion.indexOf("0.2") >= 0) {
              LOGGER.info("Channel uses feed root element (Version " + feedVersion + ").");
              LOGGER.warn("This atom version is not really supported yet, assume Atom 0.3 format");
              return Atom_0_3_Parser.getInstance().parse(cBuilder, root);
          } else if (feedVersion.indexOf("0.3") >= 0) {
View Full Code Here

    List feeds = bodyElem.getChildren("outline");
    Iterator i = feeds.iterator();
    while (i.hasNext()) {
      Element feedElem = (Element) i.next();
      // get title attribute
      Attribute attrTitle = feedElem.getAttribute("title");
      String strTitle = "[No Title]";
      if (attrTitle != null) {
        strTitle = attrTitle.getValue();
      }
      FeedIF feed = new Feed(strTitle);
      if (logger.isDebugEnabled()) {
        logger.debug("Feed element found (" + strTitle + ").");
      }
      // get text attribute
      Attribute attrText = feedElem.getAttribute("text");
      String strText = "[No Text]";
      if (attrText != null) {
        strText = attrText.getValue();
      }
      feed.setText(strText);
      // get attribute type (for example: 'rss')
      Attribute attrType = feedElem.getAttribute("type");
      String strType = "text/xml";
      if (attrType != null) {
        strType = attrType.getValue();
      }
      feed.setContentType(strType);
     
      // TODO: handle attribute version (for example: 'RSS')
     
      // get attribute xmlUrl
      Attribute attrXmlUrl = feedElem.getAttribute("xmlUrl");
      if (attrXmlUrl != null && attrXmlUrl.getValue() != null) {
        feed.setLocation(ParserUtils.getURL(attrXmlUrl.getValue()));
      }     
      // get attribute htmllUrl
      Attribute attrHtmlUrl = feedElem.getAttribute("htmlUrl");
      if (attrHtmlUrl != null && attrHtmlUrl.getValue() != null) {
        feed.setSite(ParserUtils.getURL(attrHtmlUrl.getValue()));
      }
      // set current date
      feed.setDateFound(dateParsed);
      // add feed to collection
      feedColl.add(feed);
View Full Code Here

TOP

Related Classes of org.jdom.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.