yarfraw.core.datamodel
Class Source

java.lang.Object
  extended by yarfraw.core.datamodel.Source
All Implemented Interfaces:
Serializable

public class Source
extends Object

This is only used by Rss 2.0.
Source is an optional sub-element of ItemEntry.

Its value is the name of the RSS channel that the item came from, derived from its <title>. It has one required attribute, url, which links to the XMLization of the source.

<source url="http://www.tomalak.org/links2.xml">Tomalak's Realm</source>

The purpose of this element is to propagate credit for links, to publicize the sources of news items. It can be used in the Post command of an aggregator. It should be generated automatically when forwarding an item from an aggregator to a weblog authoring tool.

Author:
jliang
See Also:
Serialized Form

Field Summary
protected  String _about
           
protected  String _base
           
protected  String _lang
           
protected  Map<QName,String> _otherAttributes
           
protected  List<Element> _otherElements
           
protected  String _resource
           
 
Constructor Summary
Source()
           
Source(String url, String source)
           
 
Method Summary
 boolean equals(Object other)
           
 String getAbout()
          This maps to the required 'about' attribute that present of all second level elements (channel, image, item, and textinput).
 String getAttributeValueByLocalName(String localName)
          Search for attributes that are not in the spec by its local name.
 String getAttributeValueByQName(QName name)
          Search for attributes that are not in the spec by its QName.
 String getBase()
          This maps to the 'base' attribute that is common in all Atom 1.0 elements.
 Element getElementByLocalName(String localName)
          Search through the other element list and return the FIRST element that matches the input localName.
 Element getElementByNS(String namespaceURI, String localName)
          Search through the other element list and return the first element that matches both input the namespaceURI and the localName.
 String getLang()
          The language attribute indicates the language that is used by the enclosed element.
 Locale getLangAsLocale()
          The language attribute indicates the language that is used by the enclosed element.
 Map<QName,String> getOtherAttributes()
          Any other attribute that is not in the RSS specs.
 List<Element> getOtherElements()
          Other additional elements that are not in the Rss specs.
 String getResource()
          This maps to the optional 'resource' attribute that present in some Rss 1.0 elements.
 String getSource()
           
 String getUrl()
           
 int hashCode()
           
 Source setSource(String source)
           
 Source setUrl(String url)
           
 String toString()
           
 void validate(FeedFormat format)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_base

protected String _base

_lang

protected String _lang

_resource

protected String _resource

_about

protected String _about

_otherAttributes

protected Map<QName,String> _otherAttributes

_otherElements

protected List<Element> _otherElements
Constructor Detail

Source

public Source()

Source

public Source(String url,
              String source)
Method Detail

getUrl

public String getUrl()

setUrl

public Source setUrl(String url)

getSource

public String getSource()

setSource

public Source setSource(String source)

validate

public void validate(FeedFormat format)
              throws ValidationException
Throws:
ValidationException

getBase

public String getBase()
This maps to the 'base' attribute that is common in all Atom 1.0 elements. Other FeedFormat will ignore this attribute.

Returns:
- attribute value.

getLang

public String getLang()
The language attribute indicates the language that is used by the enclosed element.

Returns:
- attribute value.

getLangAsLocale

public Locale getLangAsLocale()
The language attribute indicates the language that is used by the enclosed element.

Returns:
- a new Locale Object by parsing the lang attribute.

getResource

public String getResource()
This maps to the optional 'resource' attribute that present in some Rss 1.0 elements. Other FeedFormat will ignore this attribute.

Returns:
- attribute value.

getAbout

public String getAbout()
This maps to the required 'about' attribute that present of all second level elements (channel, image, item, and textinput). Other FeedFormat will ignore this attribute.

Returns:
- attribute value.

getOtherElements

public List<Element> getOtherElements()
Other additional elements that are not in the Rss specs.


getElementByNS

public Element getElementByNS(String namespaceURI,
                              String localName)
Search through the other element list and return the first element that matches both input the namespaceURI and the localName.

Parameters:
namespaceURI - - namespaceURI of the element to be search for
localName - - localName of the element
Returns:
- null if no matching element is found, the matching element otherwise.

getElementByLocalName

public Element getElementByLocalName(String localName)
Search through the other element list and return the FIRST element that matches the input localName.

Parameters:
localName - - localName of the element
Returns:
- null if no matching element is found, the matching element otherwise.

getOtherAttributes

public Map<QName,String> getOtherAttributes()
Any other attribute that is not in the RSS specs.


getAttributeValueByLocalName

public String getAttributeValueByLocalName(String localName)
Search for attributes that are not in the spec by its local name.

Parameters:
localName - localName of the attribute
Returns:
null if attribute is not found, the value of the attribute otherwise

getAttributeValueByQName

public String getAttributeValueByQName(QName name)
Search for attributes that are not in the spec by its QName.

Parameters:
name - QName of the attribute
Returns:
null if attribute is not found, the value of the attribute otherwise

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2008. All Rights Reserved.