Package org.apache.abdera.model

Examples of org.apache.abdera.model.Element


        complete();
        if (mediaRanges != null) {
            for (Map.Entry<String, String> entry : mediaRanges.entrySet()) {
                if (!accepts(entry.getKey())) {
                    try {
                        Element accept = addSimpleExtension(ACCEPT, new MimeType(entry.getKey()).toString());
                        if (entry.getValue() != null) {
                            accept.setAttributeValue(ALTERNATE, entry.getValue());
                        }
                    } catch (Exception e) {
                    }
                }
            }
View Full Code Here


        return FOMHelper.getCategories(this, scheme);
    }

    public <T extends Source> T addCategory(Category category) {
        complete();
        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.FEED_MEDIA_TYPE;
View Full Code Here

    }

    public Element addSimpleExtension(QName qname, String value) {
        complete();
        FOMFactory fomfactory = (FOMFactory)factory;
        Element el = fomfactory.newElement(qname, this);
        el.setText(value);
        String prefix = qname.getPrefix();
        declareIfNecessary(qname.getNamespaceURI(), prefix);
        return el;
    }
View Full Code Here

                                                                                                         localPart),
                                  value);
    }

    public String getSimpleExtension(QName qname) {
        Element el = getExtension(qname);
        return (el != null) ? el.getText() : null;
    }
View Full Code Here

        List<String> accept = new ArrayList<String>();
        Iterator<?> i = getChildrenWithName(ACCEPT);
        if (i == null || !i.hasNext())
            i = getChildrenWithName(PRE_RFC_ACCEPT);
        while (i.hasNext()) {
            Element e = (Element)i.next();
            String t = e.getText();
            if (t != null) {
                accept.add(t.trim());
            }
        }
        if (accept.size() > 0) {
View Full Code Here

            } else if (Type.HTML.equals(type)) {
                _removeAllChildren();
                setText(type, 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) {
                }
View Full Code Here

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

    }

    @Override
    public IRI getBaseUri() {
        if (Type.XHTML.equals(type)) {
            Element el = getValueElement();
            if (el != null) {
                if (el.getAttributeValue(BASE) != null) {
                    if (getAttributeValue(BASE) != null)
                        return super.getBaseUri().resolve(el.getAttributeValue(BASE));
                    else
                        return _getUriValue(el.getAttributeValue(BASE));
                }
            }
        }
        return super.getBaseUri();
    }
View Full Code Here

    }

    @Override
    public IRI getResolvedBaseUri() {
        if (Type.XHTML.equals(type)) {
            Element el = getValueElement();
            if (el != null) {
                if (el.getAttributeValue(BASE) != null) {
                    return super.getResolvedBaseUri().resolve(el.getAttributeValue(BASE));
                }
            }
        }
        return super.getResolvedBaseUri();
    }
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.