protected void checkItemsConstraints(Element parent) throws FeedException { int count = parent.getChildren("item",getFeedNamespace()).size(); if (count<1 || count>15) { throw new FeedException("Invalid "+getType()+" feed, item count is "+count+" it must be between 1 an 15"); } }
protected void checkItemsConstraints(Element parent) throws FeedException { int count = parent.getChildren("item",getFeedNamespace()).size(); if (count<1 || count>15) { throw new FeedException("Invalid "+getType()+" feed, item count is "+count+" it must be between 1 an 15"); } }
protected void checkLength(Element parent, String childName, int minLen, int maxLen) throws FeedException { Element child = parent.getChild(childName,getFeedNamespace()); if (child != null) { if (minLen>0 && child.getText().length()<minLen) { throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "short of "+minLen+" length"); } if (maxLen>-1 && child.getText().length()>maxLen) { throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "exceeds "+maxLen+" length"); } } }
protected void checkLength(Element parent, String childName, int minLen, int maxLen) throws FeedException { Element child = parent.getChild(childName,getFeedNamespace()); if (child != null) { if (minLen>0 && child.getText().length()<minLen) { throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "short of "+minLen+" length"); } if (maxLen>-1 && child.getText().length()>maxLen) { throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "exceeds "+maxLen+" length"); } } }
protected void checkNotNullAndLength(Element parent, String childName, int minLen, int maxLen) throws FeedException { Element child = parent.getChild(childName,getFeedNamespace()); if (child == null) { throw new FeedException("Invalid "+getType()+" feed, missing "+parent.getName()+" "+childName); } checkLength(parent,childName,minLen,maxLen); }
protected void checkNotNullAndLength(Element parent, String childName, int minLen, int maxLen) throws FeedException { Element child = parent.getChild(childName,getFeedNamespace()); if (child == null) { throw new FeedException("Invalid "+getType()+" feed, missing "+parent.getName()+" "+childName); } checkLength(parent,childName,minLen,maxLen); }
protected void checkItemsConstraints(Element parent) throws FeedException { int count = parent.getChildren("item",getFeedNamespace()).size(); if (count<1 || count>15) { throw new FeedException("Invalid "+getType()+" feed, item count is "+count+" it must be between 1 an 15"); } }
protected void checkItemsConstraints(Element parent) throws FeedException { int count = parent.getChildren("item",getFeedNamespace()).size(); if (count<1 || count>15) { throw new FeedException("Invalid "+getType()+" feed, item count is "+count+" it must be between 1 an 15"); } }
protected void checkLength(Element parent, String childName, int minLen, int maxLen) throws FeedException { Element child = parent.getChild(childName,getFeedNamespace()); if (child != null) { if (minLen>0 && child.getText().length()<minLen) { throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "short of "+minLen+" length"); } if (maxLen>-1 && child.getText().length()>maxLen) { throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "exceeds "+maxLen+" length"); } } }
protected void checkLength(Element parent, String childName, int minLen, int maxLen) throws FeedException { Element child = parent.getChild(childName,getFeedNamespace()); if (child != null) { if (minLen>0 && child.getText().length()<minLen) { throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "short of "+minLen+" length"); } if (maxLen>-1 && child.getText().length()>maxLen) { throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "exceeds "+maxLen+" length"); } } }
/** * Creates a W3C DOM document for the given WireFeed. * <p> * This method does not use the feed encoding property. * <p> * NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'. * <p> * @param feed Abstract feed to create W3C DOM document from. The type of the WireFeed must match * the type given to the FeedOuptut constructor. * @return the W3C DOM document for the given WireFeed. * @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match. * @throws FeedException thrown if the W3C DOM document for the feed could not be created. * */ public org.w3c.dom.Document outputW3CDom(WireFeed feed) throws IllegalArgumentException,FeedException { Document doc = outputJDom(feed); DOMOutputter outputter = new DOMOutputter(); try { return outputter.output(doc); } catch (JDOMException jdomEx) { throw new FeedException("Could not create DOM",jdomEx); } }
/** * Creates a W3C DOM document for the given WireFeed. * <p> * This method does not use the feed encoding property. * <p> * NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'. * <p> * @param feed Abstract feed to create W3C DOM document from. The type of the WireFeed must match * the type given to the FeedOuptut constructor. * @return the W3C DOM document for the given WireFeed. * @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match. * @throws FeedException thrown if the W3C DOM document for the feed could not be created. * */ public org.w3c.dom.Document outputW3CDom(WireFeed feed) throws IllegalArgumentException,FeedException { Document doc = outputJDom(feed); DOMOutputter outputter = new DOMOutputter(); try { return outputter.output(doc); } catch (JDOMException jdomEx) { throw new FeedException("Could not create DOM",jdomEx); } }
/** * Creates a W3C DOM document for the given WireFeed. * <p> * This method does not use the feed encoding property. * <p> * NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'. * <p> * @param feed Abstract feed to create W3C DOM document from. The type of the WireFeed must match * the type given to the FeedOuptut constructor. * @return the W3C DOM document for the given WireFeed. * @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match. * @throws FeedException thrown if the W3C DOM document for the feed could not be created. * */ public org.w3c.dom.Document outputW3CDom(WireFeed feed) throws IllegalArgumentException,FeedException { Document doc = outputJDom(feed); DOMOutputter outputter = new DOMOutputter(); try { return outputter.output(doc); } catch (JDOMException jdomEx) { throw new FeedException("Could not create DOM",jdomEx); } }
/** * Creates a W3C DOM document for the given WireFeed. * <p> * This method does not use the feed encoding property. * <p> * NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'. * <p> * @param feed Abstract feed to create W3C DOM document from. The type of the WireFeed must match * the type given to the FeedOuptut constructor. * @return the W3C DOM document for the given WireFeed. * @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match. * @throws FeedException thrown if the W3C DOM document for the feed could not be created. * */ public org.w3c.dom.Document outputW3CDom(WireFeed feed) throws IllegalArgumentException,FeedException { Document doc = outputJDom(feed); DOMOutputter outputter = new DOMOutputter(); try { return outputter.output(doc); } catch (JDOMException jdomEx) { throw new FeedException("Could not create DOM",jdomEx); } }
protected void checkNotNullAndLength(Element parent, String childName, int minLen, int maxLen) throws FeedException { Element child = parent.getChild(childName,getFeedNamespace()); if (child == null) { throw new FeedException("Invalid "+getType()+" feed, missing "+parent.getName()+" "+childName); } checkLength(parent,childName,minLen,maxLen); }
protected void checkNotNullAndLength(Element parent, String childName, int minLen, int maxLen) throws FeedException { Element child = parent.getChild(childName,getFeedNamespace()); if (child == null) { throw new FeedException("Invalid "+getType()+" feed, missing "+parent.getName()+" "+childName); } checkLength(parent,childName,minLen,maxLen); }
protected WireFeed parseFeed(Element eFeed) throws FeedException { String baseURI = null; try { baseURI = findBaseURI(eFeed); } catch (Exception e) { throw new FeedException("ERROR while finding base URI of feed", e); } Feed feed = parseFeedMetadata(baseURI, eFeed); String xmlBase = eFeed.getAttributeValue("base", Namespace.XML_NAMESPACE); if (xmlBase != null) { feed.setXmlBase(xmlBase); } feed.setModules(parseFeedModules(eFeed)); List eList = eFeed.getChildren("entry",getAtomNamespace()); if (eList.size()>0) { feed.setEntries(parseEntries(feed, baseURI, eList)); } List foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace()); if (foreignMarkup.size() > 0) { feed.setForeignMarkup(foreignMarkup); } return feed; }
protected WireFeed parseFeed(Element eFeed) throws FeedException { String baseURI = null; try { baseURI = findBaseURI(eFeed); } catch (Exception e) { throw new FeedException("ERROR while finding base URI of feed", e); } Feed feed = parseFeedMetadata(baseURI, eFeed); String xmlBase = eFeed.getAttributeValue("base", Namespace.XML_NAMESPACE); if (xmlBase != null) { feed.setXmlBase(xmlBase); } feed.setModules(parseFeedModules(eFeed)); List eList = eFeed.getChildren("entry",getAtomNamespace()); if (eList.size()>0) { feed.setEntries(parseEntries(feed, baseURI, eList)); } List foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace()); if (foreignMarkup.size() > 0) { feed.setForeignMarkup(foreignMarkup); } return feed; }
protected WireFeed parseFeed(Element eFeed) throws FeedException { String baseURI = null; try { baseURI = findBaseURI(eFeed); } catch (Exception e) { throw new FeedException("ERROR while finding base URI of feed", e); } Feed feed = parseFeedMetadata(baseURI, eFeed); String xmlBase = eFeed.getAttributeValue("base", Namespace.XML_NAMESPACE); if (xmlBase != null) { feed.setXmlBase(xmlBase); } feed.setModules(parseFeedModules(eFeed)); List eList = eFeed.getChildren("entry",getAtomNamespace()); if (eList.size()>0) { feed.setEntries(parseEntries(feed, baseURI, eList)); } List foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace()); if (foreignMarkup.size() > 0) { feed.setForeignMarkup(foreignMarkup); } return feed; }
protected WireFeed parseFeed(Element eFeed) throws FeedException { String baseURI = null; try { baseURI = findBaseURI(eFeed); } catch (Exception e) { throw new FeedException("ERROR while finding base URI of feed", e); } Feed feed = parseFeedMetadata(baseURI, eFeed); String xmlBase = eFeed.getAttributeValue("base", Namespace.XML_NAMESPACE); if (xmlBase != null) { feed.setXmlBase(xmlBase); } feed.setModules(parseFeedModules(eFeed)); List eList = eFeed.getChildren("entry",getAtomNamespace()); if (eList.size()>0) { feed.setEntries(parseEntries(feed, baseURI, eList)); } List foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace()); if (foreignMarkup.size() > 0) { feed.setForeignMarkup(foreignMarkup); } return feed; }