com.webmethods.caf.faces.data.export.atom
Class Element

java.lang.Object
  extended by com.webmethods.caf.faces.data.export.atom.Element
Direct Known Subclasses:
Category, Date, Entry, Generator, Link, Person, Source, Text

public class Element
extends Object

Represents a generic xml element.


Nested Class Summary
protected static class Element.ElementContentType
           
protected static class Element.Property
           
 
Field Summary
protected  Map m_attributes
           
protected  String m_base
           
protected  BaseURI m_baseURI
           
protected  List m_children
           
protected  String m_content
           
protected  String m_lang
           
protected  String m_name
           
protected  Element m_parent
           
protected static Pattern STRIP_FROM_NORMAL_NAME
           
 
Constructor Summary
Element()
           
Element(Object o)
           
 
Method Summary
protected  void enforceChildrenConformance(Element e)
          Calls enforceConformance on child Element.
protected  void enforceChildrenConformance(List ee)
          Calls enforceConformance on children Elements.
 void enforceConformance()
          Execute any additional logic needed to make this element conform to the atom (or other) spec.
protected  void escapeXMLContent(PrintWriter out, String s)
          Escapes xml content.
protected  void escapeXMLName(PrintWriter out, String s)
          Escapes xml element or attribute name.
protected  Object firstValue(Object o)
          Returns the first value from a collection/array, or simply the value itself.
 Map getAttributes()
           
 String getBase()
           
 BaseUri getBaseUri()
          Deprecated. use Element.getBaseURI()
 BaseURI getBaseURI()
           
 List getChildren()
           
 String getContent()
           
 String getLang()
           
 String getName()
           
 Element getParent()
           
protected  void initialize(Object o)
          Initialize with specified object.
protected  Collection multipleValues(Object o)
          Returns a collection/array as a collection, a non-null value as a collection containing that single value, or a null value as an empty collection.
protected  void printAttribute(PrintWriter out, String name, String value)
          Prints an attribute with the specified name and value, escaping both name and value.
protected  void printChildren(PrintWriter out, int tabs, Element e)
          Prints the specified child Element.
protected  void printChildren(PrintWriter out, int tabs, List ee)
          Prints the specified list of children Elements.
protected  void printChildren(PrintWriter out, int tabs, String name, String content)
          Prints a child element with the specified name and content, escaping both name and content.
protected  Element.ElementContentType printContent(PrintWriter out, int tabs)
          Prints the content for this element.
protected  void printEndTag(PrintWriter out, int tabs, Element.ElementContentType type)
          Prints the end tag for this element.
protected  void printStartTag(PrintWriter out, int tabs)
          Prints the start tag for this element.
protected  void printTextualContent(PrintWriter out, String content)
          Prints the specified textual content for this element, escaping as necessary.
 void serialize(PrintWriter out, int tabs)
          Serialize this element, pretty-print to the specified tab stop.
 void setAttributes(Map attributes)
           
 void setBase(String base)
           
 void setChildren(List children)
           
 void setContent(String content)
           
 void setLang(String lang)
           
 void setName(String name)
           
 void setParent(Element parent)
           
protected  void setProperties(IContentProvider provider, Collection keys)
          Set the normalized properties of this element.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STRIP_FROM_NORMAL_NAME

protected static final Pattern STRIP_FROM_NORMAL_NAME

m_attributes

protected Map m_attributes

m_children

protected List m_children

m_parent

protected Element m_parent

m_content

protected String m_content

m_name

protected String m_name

m_baseURI

protected BaseURI m_baseURI

m_base

protected String m_base

m_lang

protected String m_lang
Constructor Detail

Element

public Element()

Element

public Element(Object o)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

enforceConformance

public void enforceConformance()
Execute any additional logic needed to make this element conform to the atom (or other) spec.


enforceChildrenConformance

protected void enforceChildrenConformance(List ee)
Calls enforceConformance on children Elements.


enforceChildrenConformance

protected void enforceChildrenConformance(Element e)
Calls enforceConformance on child Element.


initialize

protected void initialize(Object o)
Initialize with specified object.


setProperties

protected void setProperties(IContentProvider provider,
                             Collection keys)
Set the normalized properties of this element.


firstValue

protected Object firstValue(Object o)
Returns the first value from a collection/array, or simply the value itself. May be null.


multipleValues

protected Collection multipleValues(Object o)
Returns a collection/array as a collection, a non-null value as a collection containing that single value, or a null value as an empty collection.


serialize

public void serialize(PrintWriter out,
                      int tabs)
Serialize this element, pretty-print to the specified tab stop.


printStartTag

protected void printStartTag(PrintWriter out,
                             int tabs)
Prints the start tag for this element. Includes open bracket, tag name, and attributes, but not close bracket (">").


printContent

protected Element.ElementContentType printContent(PrintWriter out,
                                                  int tabs)
Prints the content for this element. Includes close bracket for start tag (">"), if needed, child elements, and textual content.


printAttribute

protected void printAttribute(PrintWriter out,
                              String name,
                              String value)
Prints an attribute with the specified name and value, escaping both name and value. Prints nothing if null value.


printChildren

protected void printChildren(PrintWriter out,
                             int tabs,
                             List ee)
Prints the specified list of children Elements.


printChildren

protected void printChildren(PrintWriter out,
                             int tabs,
                             Element e)
Prints the specified child Element.


printChildren

protected void printChildren(PrintWriter out,
                             int tabs,
                             String name,
                             String content)
Prints a child element with the specified name and content, escaping both name and content. Prints nothing if null content.


printTextualContent

protected void printTextualContent(PrintWriter out,
                                   String content)
Prints the specified textual content for this element, escaping as necessary.


printEndTag

protected void printEndTag(PrintWriter out,
                           int tabs,
                           Element.ElementContentType type)
Prints the end tag for this element. If the type is ElementContentType.EMPTY, prints " />" end of start tag. Otherwise, prints full end tag.


escapeXMLName

protected void escapeXMLName(PrintWriter out,
                             String s)
Escapes xml element or attribute name.


escapeXMLContent

protected void escapeXMLContent(PrintWriter out,
                                String s)
Escapes xml content.


getAttributes

public Map getAttributes()

setAttributes

public void setAttributes(Map attributes)

getChildren

public List getChildren()

setChildren

public void setChildren(List children)

getParent

public Element getParent()

setParent

public void setParent(Element parent)

getContent

public String getContent()

setContent

public void setContent(String content)

getName

public String getName()

setName

public void setName(String name)

getBase

public String getBase()

setBase

public void setBase(String base)

getBaseURI

public BaseURI getBaseURI()

getBaseUri

public BaseUri getBaseUri()
Deprecated. use Element.getBaseURI()


getLang

public String getLang()

setLang

public void setLang(String lang)