Package org.rometools.feed.module.base

Examples of org.rometools.feed.module.base.CustomTag


        List tags = ((CustomTags)module).getValues();
        Iterator it = tags.iterator();

        while(it.hasNext()) {
            CustomTag tag = (CustomTag)it.next();

            if(tag.getValue() instanceof DateTimeRange) {
                DateTimeRange dtr = (DateTimeRange)tag.getValue();
                Element newTag = new Element(tag.getName(),CustomTagParser.NS);
                newTag.setAttribute("type","dateTimeRange");
                newTag.addContent(this.generateSimpleElement("start",GoogleBaseParser.LONG_DT_FMT.format(dtr.getStart())));
                newTag.addContent(this.generateSimpleElement("end",GoogleBaseParser.LONG_DT_FMT.format(dtr.getEnd())));
                element.addContent(newTag);
            } else if(tag.getValue() instanceof ShortDate) {
                ShortDate sd = (ShortDate)tag.getValue();
                Element newTag = this.generateSimpleElement(tag.getName(),GoogleBaseParser.SHORT_DT_FMT.format(sd));
                newTag.setAttribute("type","date");
                element.addContent(newTag);
            } else if(tag.getValue() instanceof Date) {
                Date d = (Date)tag.getValue();
                Element newTag = this.generateSimpleElement(tag.getName(),GoogleBaseParser.SHORT_DT_FMT.format(d));
                newTag.setAttribute("type","dateTime");
                element.addContent(newTag);
            } else if(tag.getValue() instanceof Integer) {
                Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
                newTag.setAttribute("type","int");
                element.addContent(newTag);
            } else if(tag.getValue() instanceof IntUnit) {
                Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
                newTag.setAttribute("type","intUnit");
                element.addContent(newTag);
            } else if(tag.getValue() instanceof Float) {
                Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
                newTag.setAttribute("type","float");
                element.addContent(newTag);
            } else if(tag.getValue() instanceof FloatUnit) {
                Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
                newTag.setAttribute("type","floatUnit");
                element.addContent(newTag);
            } else if(tag.getValue() instanceof String) {
                Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
                newTag.setAttribute("type","string");
                element.addContent(newTag);
            } else if(tag.getValue() instanceof URL) {
                Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
                newTag.setAttribute("type","url");
                element.addContent(newTag);
            } else if(tag.getValue() instanceof Boolean) {
                Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
                newTag.setAttribute("type","boolean");
                element.addContent(newTag);
            } else if( tag.getValue() instanceof CustomTagImpl.Location ){
    Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
                newTag.setAttribute("type","location");
                element.addContent(newTag);
      }
        }
    }
View Full Code Here

TOP

Related Classes of org.rometools.feed.module.base.CustomTag

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.