Package org.jdom

Examples of org.jdom.Attribute


  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("OPML", attribute.getValue())); //$NON-NLS-1$
    }

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


    INews news = Owl.getModelFactory().createNews(null, feed, new Date(System.currentTimeMillis() - (fNewsCounter++ * 1)));

    /* Interpret Attributes */
    List< ? > outlineAttributes = element.getAttributes();
    for (Iterator< ? > iter = outlineAttributes.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;

      /* Title */
      else if ("title".equals(name)) //$NON-NLS-1$
        news.setTitle(attribute.getValue());

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

      /* HTML URL - If not yet set as Link */
      else if ("htmlurl".equals(name) && news.getLink() == null) { //$NON-NLS-1$
        URI uri = URIUtils.createURI(attribute.getValue());
        if (uri != null)
          news.setLink(uri);
      }

      /* XML URL */
      else if ("xmlurl".equals(name)) { //$NON-NLS-1$
        URI uri = URIUtils.createURI(attribute.getValue());
        if (uri != null) {
          ISource source = Owl.getModelFactory().createSource(news);
          source.setLink(uri);
        }
      }

      /* Text */
      else if ("text".equals(name)) //$NON-NLS-1$
        news.setDescription(attribute.getValue());

      /* Description */
      else if ("description".equals(name)) //$NON-NLS-1$
        news.setDescription(attribute.getValue());
    }

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

    String description = null;

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

      /* Link */
      if (name.toLowerCase().equals("xmlurl")) //$NON-NLS-1$
        link = attribute.getValue();

      /* Title */
      else if (name.toLowerCase().equals("title")) //$NON-NLS-1$
        title = attribute.getValue();

      /* Text */
      else if (title == null && name.toLowerCase().equals("text")) //$NON-NLS-1$
        title = attribute.getValue();

      /* Homepage */
      else if (name.toLowerCase().equals("htmlurl")) //$NON-NLS-1$
        homepage = attribute.getValue();

      /* Description */
      else if (name.toLowerCase().equals("description")) //$NON-NLS-1$
        description = attribute.getValue();
    }

    /* Outline is a Category */
    if (link == null && title != null) {
      type = Owl.getModelFactory().createFolder(null, (IFolder) parent, title);
View Full Code Here

    String description = null;

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

      /* Link */
      if (name.toLowerCase().equals("xmlurl")) //$NON-NLS-1$
        link = attribute.getValue();

      /* Title */
      else if (name.toLowerCase().equals("title")) //$NON-NLS-1$
        title = attribute.getValue();

      /* Text */
      else if (title == null && name.toLowerCase().equals("text")) //$NON-NLS-1$
        title = attribute.getValue();

      /* Homepage */
      else if (name.toLowerCase().equals("htmlurl")) //$NON-NLS-1$
        homepage = attribute.getValue();

      /* Description */
      else if (name.toLowerCase().equals("description")) //$NON-NLS-1$
        description = attribute.getValue();
    }

    /* Outline is a Folder */
    if (link == null && title != null) {
      type = Owl.getModelFactory().createFolder(null, (IFolder) parent, title);
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("RSS", attribute.getValue())); //$NON-NLS-1$
    }

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

  private void processChannel(Element element, IFeed feed) {

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

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

View Full Code Here

    ICloud cloud = Owl.getModelFactory().createCloud(feed);

    /* Interpret Attributes */
    List< ? > cloudAttributes = element.getAttributes();
    for (Iterator< ? > iter = cloudAttributes.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, cloud))
        continue;

      /* Domain */
      else if ("domain".equals(name)) //$NON-NLS-1$
        cloud.setDomain(attribute.getValue());

      /* Path */
      else if ("path".equals(name)) //$NON-NLS-1$
        cloud.setPath(attribute.getValue());

      /* Port */
      else if ("port".equals(name)) {//$NON-NLS-1$
        int port = StringUtils.stringToInt(attribute.getValue());
        if (port >= 0)
          cloud.setPort(port);
      }

      /* Procedure Call */
      else if ("registerprocedure".equals(name)) //$NON-NLS-1$
        cloud.setRegisterProcedure(attribute.getValue());

      /* Path */
      else if ("protocol".equals(name)) //$NON-NLS-1$
        cloud.setProtocol(attribute.getValue());
    }
  }
View Full Code Here

    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

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.