Package org.apache.abdera.model

Examples of org.apache.abdera.model.Element


    if (signingKey == null || cert == null) return doc; // pass through
    Signature sig = security.getSignature();
    SignatureOptions options = sig.getDefaultSignatureOptions();   
    options.setCertificate(cert);
    options.setSigningKey(signingKey);
    Element element = doc.getRoot();
    element = sig.sign(element, options);
    return element.getDocument();
  }
View Full Code Here


    private ExtensibleElement createExtension(LogRecord record) {
        ExtensibleElement erec = factory.newExtensionElement(qn("logRecord"));
       
        // forget about single line "addExtension().setText()" since
        // javac failure "org.apache.abdera.model.Element cannot be dereferenced"
        Element e = erec.addExtension(qn("eventTimestamp"));
        e.setText(toAtomDateFormat(record.getEventTimestamp()));
        e = erec.addExtension(qn("level"));
        e.setText(record.getLevel().toString());
        e = erec.addExtension(qn("loggerName"));
        e.setText(record.getLoggerName());
        e = erec.addExtension(qn("message"));
        e.setText(record.getMessage());
        e = erec.addExtension(qn("threadName"));
        e.setText(record.getThreadName());
        e = erec.addExtension(qn("throwable"));
        e.setText(record.getThrowable());
        return erec;
    }
View Full Code Here

            reportError("Atom feed can only be created from a collection wrapper", null);
        } else if (!isFeed && isCollection) {
            reportError("Atom entry can only be created from a single object", null);
        }
       
        Element atomElement = null;
        try {
            if (isFeed && !isCollection) {
                atomElement = createFeedFromCollectionWrapper(o);
            } else if (!isFeed && !isCollection) {
                atomElement = createEntryFromObject(o, clazz);
View Full Code Here

   * @param element The parent element
   * @param child The XML QName of the child element
   * @return The directionally-wrapped text of the child element
   */
  public static <T extends Element>String getBidiChildText(T element, QName child) {
    Element el = element.getFirstChild(child);
    return (el != null) ? getBidiText(getDirection(el),el.getText()) : null;
  }
View Full Code Here

  public List<Category> getCategories(String scheme) throws IRISyntaxException {
    return FOMHelper.getCategories(this, scheme);
  }

  public void addCategory(Category category) {
    Element el = category.getParentElement();
    if (el != null && el instanceof Categories) {
      Categories cats = category.getParentElement();
      category = (Category) category.clone();
      try {
        if (category.getScheme() == null && cats.getScheme() != null)
View Full Code Here

    if (base instanceof Document) {
      Document doc = (Document)base;
      MimeType mt = doc.getContentType();
      type = (mt != null) ? mt.toString() : getMimeType(doc.getRoot());
    } else if (base instanceof Element) {
      Element el = (Element)base;
      if (el.getDocument() != null) {
        MimeType mt = el.getDocument().getContentType();
        type = (mt != null) ? mt.toString() : null;
      }
      if (type == null) {
        if (el instanceof Feed)
          type = Constants.ATOM_MEDIA_TYPE;
View Full Code Here

    assertEquals(generator.getUri().toString(), Version.URI);
    Div div = factory.newDiv();
    assertNotNull(div);
    Document doc = factory.newDocument();
    assertNotNull(doc);
    Element el = factory.newEmail();
    assertNotNull(el);
    el = factory.newEmail();
    el.setText("a");
    assertEquals(el.getText(), "a");
    Entry entry = factory.newEntry();
    assertNotNull(entry);
    entry = factory.newEntry();
    assertNotNull(entry);
    Element ee = factory.newExtensionElement(new QName("urn:foo", "bar", "b"));
    assertNotNull(ee);
    assertEquals(ee.getQName(), new QName("urn:foo", "bar", "b"));
    Feed feed = factory.newFeed();
    assertNotNull(feed);
    generator = factory.newGenerator();
    assertNotNull(generator);
    generator = factory.newGenerator();
View Full Code Here

        case OMNode.DTD_NODE:
          OMDocType doctype = (OMDocType) node;
          factory.createOMDocType(omdoc, doctype.getValue());
          break;
        case OMNode.ELEMENT_NODE:
          Element el = (Element) node;
          omdoc.addChild((OMNode) el.clone());
          break;
        case OMNode.PI_NODE:
          OMProcessingInstruction pi = (OMProcessingInstruction) node;
          factory.createOMProcessingInstruction(omdoc, pi.getTarget(), pi.getValue());
          break;
View Full Code Here

      } else if (Type.HTML.equals(type)) {
        _removeAllChildren();
        super.setText(value);
      } else if (Type.XHTML.equals(type)) {
        IRI baseUri = null;
        Element element = null;
        value = "<div xmlns=\"" + XHTML_NS + "\">" + value + "</div>";
        try {
          baseUri = getResolvedBaseUri();
          element = _parse(value, baseUri);
        } catch (Exception e) {}
        if (element != null && element instanceof Div)
          setValueElement((Div)element);
      } else if (Type.XML.equals(type)) {
        IRI baseUri = null;
        Element element = null;
        try {
          baseUri = getResolvedBaseUri();
          element = _parse(value, baseUri);
        } catch (Exception e) {}
        if (element != null)
View Full Code Here

  }

  public void setWrappedValue(String wrappedValue) {
    if (Type.XHTML.equals(type)) {
      IRI baseUri = null;
      Element element = null;
      try {
        baseUri = getResolvedBaseUri();
        element = _parse(wrappedValue, baseUri);
      } catch (Exception e) {}
      if (element != null && element instanceof Div)
View Full Code Here

TOP

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

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.