logger.info("geeeeeeeeeeeeeeeh");
logger.debug("geeeeeeeeeeeeeeeh");
	public ChannelIF parse(ChannelIF cBuilder, Element root)			throws ParseException {		if (cBuilder == null) {			throw new RuntimeException("Without builder no channel can "					+ "be created.");		}		Date dateParsed = new Date();		Namespace defNS = ParserUtils.getDefaultNS(root);		if (defNS == null) {			defNS = Namespace.NO_NAMESPACE;			logger.info("No default namespace found.");		}		// RSS 1.0 Dublin Core Module namespace		Namespace dcNS = ParserUtils.getNamespace(root, "dc");		// fall back to default name space (for retrieving descriptions)		if (dcNS == null) {			dcNS = defNS;		}		// RSS 1.0 Syndication Module namespace		Namespace syNS = ParserUtils.getNamespace(root, "sy");		// RSS 1.0 Aggregation Module namespace		Namespace agNS = ParserUtils.getNamespace(root, "ag");		// RSS 1.0 Administration Module namespace		Namespace adminNS = ParserUtils.getNamespace(root, "admin");		// RSS 1.0 DCTerms Module namespace		Namespace dctermsNS = ParserUtils.getNamespace(root, "dcterms");		// RSS 1.0 Annotation Module namespace		Namespace annotateNS = ParserUtils.getNamespace(root, "annotate");		// RSS091 Module namespace		Namespace rss091NS = ParserUtils.getNamespace(root, "rss091");		// Get the channel element (only one occurs)		Element channel = root.getChild("channel", defNS);		if (channel == null) {			logger.warn("Channel element could not be retrieved from feed.");			throw new ParseException("No channel element found in feed.");		}		//END NAMESPACE Management		// ----------------------- read in channel information		// title element		cBuilder.setTitle(channel.getChildTextTrim("title", defNS));	      ChannelIF chnl = cBuilder;				// set channel format		chnl.setFormat(ChannelFormat.RSS_1_0);		// description element		chnl.setDescription(channel.getChildTextTrim("description", defNS));		// link element		chnl.setSite(ParserUtils				.getURL(channel.getChildTextTrim("link", defNS)));		// creator element		Element creator = channel.getChild("creator", dcNS);		if (creator == null) {			creator = channel.getChild("managingEditor", rss091NS);		}		if (creator != null) {			chnl.setCreator(creator.getTextTrim());		}		// publisher element		String publisher = channel.getChildTextTrim("publisher", dcNS);		if (publisher == null) {			Element elErrorReportsTo = channel.getChild("errorReportsTo",					adminNS);			if (elErrorReportsTo != null) {				publisher = elErrorReportsTo.getAttributeValue("resource",						ParserUtils.getNamespace(elErrorReportsTo, "rdf"));			}		}		if (publisher == null) {			publisher = channel.getChildTextTrim("webMaster", rss091NS);		}		chnl.setPublisher(publisher);		// language element		Element language = channel.getChild("language", dcNS);		if (language == null) {			language = channel.getChild("language", rss091NS);		}		if (language != null) {			chnl.setLanguage(language.getTextTrim());		}		// rights element		Element copyright = channel.getChild("rights", dcNS);		if (copyright == null) {			copyright = channel.getChild("copyright", rss091NS);		}		if (copyright != null) {			chnl.setCopyright(copyright.getTextTrim());		}		// 0..1 Rating element		Element rating = channel.getChild("rating", rss091NS);		if (rating != null) {			chnl.setRating(rating.getTextTrim());		}		// 0..1 Docs element		// use namespace URI		chnl.setDocs(defNS.getURI());		// 0..1 pubDate element		Element pubDate = channel.getChild("date", dcNS);		if (pubDate == null) {			pubDate = channel.getChild("issued", dctermsNS);		}		if (pubDate == null) {			pubDate = channel.getChild("pubdate", rss091NS);		}		if (pubDate != null) {			chnl.setPubDate(ParserUtils.getDate(pubDate.getTextTrim()));		}		// 0..1 lastBuildDate element		Element lastBuildDate = channel.getChild("lastBuildDate");		if (lastBuildDate == null) {			lastBuildDate = channel.getChild("modified", dctermsNS);		}		if (lastBuildDate == null) {			lastBuildDate = channel.getChild("lastBuildDate", rss091NS);		}		if (lastBuildDate != null) {			chnl.setLastBuildDate(ParserUtils.getDate(lastBuildDate					.getTextTrim()));		}		// RSS 1.0 Administration Module support		// 0..1 generator element		Element elGenerator = channel.getChild("generatorAgent", adminNS);		if (elGenerator != null) {			Attribute generator = elGenerator.getAttribute("resource",					ParserUtils.getNamespace(elGenerator, "rdf"));			if (generator != null) {				chnl.setGenerator(generator.getValue());			}		}		// RSS 1.0 Syndication Module support		// 0..1 update period element		Element updatePeriod = channel.getChild("updatePeriod", syNS);		if (updatePeriod != null) {			chnl.setUpdatePeriod(updatePeriod.getTextTrim());		}		// 0..1 update frequency element		Element updateFrequency = channel.getChild("updateFrequency", syNS);		if (updateFrequency != null) {			chnl					.setUpdateFrequency((new Integer(updateFrequency							.getTextTrim())).intValue());		}		// 0..1 update base element		Element updateBase = channel.getChild("updateBase", syNS);		if (updateBase != null) {			chnl.setUpdateBase(ParserUtils.getDate(updateBase.getTextTrim()));		}		if ((updatePeriod != null) && updateFrequency != null) {			int ttl = getTtl(chnl.getUpdatePeriod(), chnl.getUpdateFrequency());			chnl.setTtl(ttl);		}		// item elements		List items = root.getChildren("item", defNS);		Iterator i = items.iterator();		while (i.hasNext()) {			Element item = (Element) i.next();			// get title element			Element elTitle = item.getChild("title", defNS);			String strTitle = "<No Title>";			if (elTitle != null) {				strTitle = elTitle.getTextTrim();			}			if (logger.isDebugEnabled()) {				logger.debug("Item element found (" + strTitle + ").");			}			// get link element			Element elLink = item.getChild("link", defNS);			String strLink = "";			if (elLink != null) {				strLink = elLink.getTextTrim();			}			// get description element			Element elDesc = item.getChild("description", defNS);			if (elDesc == null) {				elDesc = item.getChild("description", dcNS);			}			String strDesc = "";			if (elDesc != null) {				strDesc = elDesc.getTextTrim();			}			// generate new RSS item (link to article)			ItemIF rssItem = ChannelBuilder.createItem(item, null, strTitle, strDesc,					ParserUtils.getURL(strLink));			rssItem.setFound(dateParsed);			// get creator element			Element elCreator = item.getChild("creator", dcNS);			if (elCreator != null) {				rssItem.setCreator(elCreator.getTextTrim());			}			// get subject element			Element elSubject = item.getChild("subject", dcNS);			if (elSubject != null) {				// TODO: Mulitple subject elements not handled currently				rssItem.setSubject(elSubject.getTextTrim());			}			// get date element			Element elDate = item.getChild("date", dcNS);			if (elDate != null) {				rssItem.setDate(ParserUtils.getDate(elDate.getTextTrim()));			}			/*			 * This Element not currently set/used in or Application For			 * Simplicity we do not persist this Information in DB			 * 			 * However it's part of the Spec and will eventually used at a later			 * point in our application			 * 			 * Roland Vecera 10. Feb 2005			 *  // get source element - default to Aggregation module, then try			 * Dublin Core String sourceName = null; String sourceLocation =			 * null; Date sourceTimestamp = null;			 * 			 * Element elSourceURL = item.getChild("sourceURL", agNS); if			 * (elSourceURL == null) { // No Aggregation module - try Dublin			 * Core elSourceURL = item.getChild("source", dcNS); if (elSourceURL !=			 * null) { sourceLocation = elSourceURL.getTextTrim(); sourceName =			 * "Source"; } } else { // Aggregation module sourceLocation =			 * elSourceURL.getTextTrim(); Element elSourceName =			 * item.getChild("source", agNS); if (elSourceName != null) {			 * sourceName = elSourceName.getTextTrim(); } Element			 * elSourceTimestamp = item.getChild("timestamp", agNS); if			 * (elSourceTimestamp != null) { sourceTimestamp =			 * ParserUtils.getDate(elSourceTimestamp.getTextTrim()); } }			 * 			 * if (sourceLocation != null) { ItemSourceIF itemSource =			 * cBuilder.createItemSource(rssItem, sourceName, sourceLocation,			 * sourceTimestamp); rssItem.setSource(itemSource); }			 */			// comments element - use Annotation module			Element elReference = item.getChild("reference", annotateNS);			if (elReference != null) {				Attribute resource = elReference.getAttribute("resource",						ParserUtils.getNamespace(elReference, "rdf"));				if (resource != null) {					URL resourceURL = ParserUtils.getURL(resource.getValue());					if (resourceURL != null) {						rssItem.setComments(resourceURL);					}				}			}			logger.info("geeeeeeeeeeeeeeeh");			chnl.addItem(rssItem);		}//End While = END <items>		// image element		/*		Element image = root.getChild("image", defNS);		if (image != null) {			ImageIF rssImage = ChannelBuilder.createImage(image.getChildTextTrim(					"title", defNS), ParserUtils.getURL(image.getChildTextTrim(					"url", defNS)), ParserUtils.getURL(image.getChildTextTrim(					"link", defNS)));			Element imgWidth = image.getChild("width", defNS);			if (imgWidth != null) {				try {					rssImage.setWidth(Integer.parseInt(imgWidth.getTextTrim()));				} catch (NumberFormatException e) {					logger.warn(e);				}			}			Element imgHeight = image.getChild("height", defNS);			if (imgHeight != null) {				try {					rssImage.setHeight(Integer							.parseInt(imgHeight.getTextTrim()));				} catch (NumberFormatException e) {					logger.warn(e);				}			}			Element imgDescr = image.getChild("description", defNS);			if (imgDescr != null) {				rssImage.setDescription(imgDescr.getTextTrim());			}			chnl.setImage(rssImage);		}*/		/*		 * This Element not currently set/used in or Application For Simplicity		 * we do not persist this Information in DB		 * 		 * However it's part of the Spec and will eventually used at a later		 * point in our application		 * 		 * Roland Vecera 10. Feb 2005		 *  // textinput element Element txtinp = root.getChild("textinput",		 * defNS); if (txtinp != null) { String tiTitle = null; if		 * (txtinp.getChild("title", defNS) != null) { tiTitle =		 * txtinp.getChild("title", defNS).getTextTrim(); } String tiDescr =		 * null; if (txtinp.getChild("description", defNS) != null) { tiDescr =		 * txtinp.getChild("description", defNS).getTextTrim(); } String tiName =		 * null; if (txtinp.getChild("name", defNS) != null) { tiName =		 * txtinp.getChild("name", defNS).getTextTrim(); } URL tiLink = null; if		 * (txtinp.getChild("link", defNS) != null) { tiLink =		 * ParserUtils.getURL(txtinp.getChild("link", defNS).getTextTrim()); }		 * TextInputIF rssTextInput = cBuilder.createTextInput(tiTitle, tiDescr,		 * tiName, tiLink); chnl.setTextInput(rssTextInput); }		 */		chnl.setLastUpdated(dateParsed);		return chnl;	}