Package org.apache.abdera.model

Examples of org.apache.abdera.model.Content

Per RFC4287:

 The "atom:content" element either contains or links to the content of the entry.  The content of atom:content is Language-Sensitive. atomInlineTextContent = element atom:content { atomCommonAttributes, attribute type { "text" | "html" }?, (text) } atomInlineXHTMLContent = element atom:content { atomCommonAttributes, attribute type { "xhtml" }, xhtmlDiv } atomInlineOtherContent = element atom:content { atomCommonAttributes, attribute type { atomMediaType }?, (text|anyElement) } atomOutOfLineContent = element atom:content { atomCommonAttributes, attribute type { atomMediaType }?, attribute src { atomUri }, empty } atomContent = atomInlineTextContent | atomInlineXHTMLContent | atomInlineOtherContent | atomOutOfLineContent 

    
     Feed feed = doc.getRoot();
     assertNotNull(feed);
     List<Entry> entries = feed.getEntries();
     for (Entry entry : entries) {
       Content content = entry.getContentElement();
       assertNotNull(content);
       assertEquals(content.getContentType(), Content.Type.MEDIA);
       assertEquals(content.getResolvedSrc(), uri.resolve("2003/12/12/atom03.pdf"));
     }
   }
View Full Code Here


    
     Feed feed = doc.getRoot();
     assertNotNull(feed);
     List<Entry> entries = feed.getEntries();
     for (Entry entry : entries) {
       Content content = entry.getContentElement();
       assertNotNull(content);
       assertEquals(entry.getContentElement().getContentType(), Content.Type.XML);
     }
   }
View Full Code Here

     //http://feedvalidator.org/testcases/atom/4.1.3.3/content-svg-mixed.xml
     IRI uri = baseURI.resolve("4.1.3.3/content-svg-mixed.xml");
     Document<Feed> doc = get(uri);
     assertNotNull(doc);
     Entry entry = doc.getRoot().getEntries().get(0);
     Content content = entry.getContentElement();
     assertNotNull(content.getValueElement()); // we're pretty forgiving
     assertEquals(content.getContentType(), Content.Type.XML);
   }
View Full Code Here

    
     Feed feed = doc.getRoot();
     assertNotNull(feed);
     List<Entry> entries = feed.getEntries();
     for (Entry entry : entries) {
       Content content = entry.getContentElement();
       assertNotNull(content);
       assertEquals(entry.getContentElement().getContentType(), Content.Type.XML);
     }
   }
View Full Code Here

    return (Content)getFirstChildWithName(CONTENT);
  }

  public void setContentElement(Content content) {
    if (content != null) {
      Content element = getContentElement();
      if (element != null) element.discard();
      _setChild(CONTENT, (OMElement)content);
    } else {
      _removeChildren(CONTENT, false);
    }
  }
View Full Code Here

  /**
   * Sets the content for this entry as @type="text"
   */
  public Content setContent(String value) {
    FOMFactory factory = (FOMFactory) this.factory;
    Content content = factory.newContent();
    content.setValue(value);
    setContentElement(content);
    return content;
  }
View Full Code Here

  /**
   * Sets the content for this entry
   */
  public Content setContent(String value, Content.Type type) {
    FOMFactory factory = (FOMFactory) this.factory;
    Content content = factory.newContent(type);
    content.setValue(value);
    setContentElement(content);
    return content;
  }
View Full Code Here

  /**
   * Sets the content for this entry
   */
  public Content setContent(Element value) {
    FOMFactory factory = (FOMFactory) this.factory;
    Content content = factory.newContent(Content.Type.XHTML);
    content.setValueElement(value);
    setContentElement(content);
    return content;
  }
View Full Code Here

   * Sets the content for this entry
   * @throws MimeTypeParseException
   */
  public Content setContent(Element element, String mediaType) throws MimeTypeParseException {
    FOMFactory factory = (FOMFactory) this.factory;
    Content content = factory.newContent(new MimeType(mediaType), element);
    setContentElement(content);
    return content;
  }
View Full Code Here

   * Sets the content for this entry
   * @throws MimeTypeParseException
   */
  public Content setContent(DataHandler dataHandler, String mediatype) throws MimeTypeParseException {
    FOMFactory factory = (FOMFactory) this.factory;
    Content content = factory.newContent(new MimeType(mediatype));
    content.setDataHandler(dataHandler);
    setContentElement(content);
    return content;
  }
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.Content

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.