com.google.gdata.util.common.xml
Class XmlWriter.Element

java.lang.Object
  extended by com.google.gdata.util.common.xml.XmlWriter.Element
Enclosing class:
XmlWriter

protected static class XmlWriter.Element
extends java.lang.Object

The Element class contains information about an XML element. Used to keep track of namespace alias/URI mappings. This class may be subclassed by XmlWriter subclasses that want to track additional information about output elements. The XmlWriter.createElement(String, String, String) method can be overridden to instantiate a specialized Element subclass.


Field Summary
 java.lang.String enclosingDefaultNamespace
          The default namespace uri that will be active after closure of this element.
 boolean hasAttributes
          True if the element has attributes.
 java.lang.String name
          Local name of the element.
static int NOT_REPEATING
          Sentinel value used for repeating elements.
 java.lang.String nsAlias
          Namespace prefix for the element.
 java.util.List<XmlNamespace> nsDecls
          Namespace declarations associated with this element.
 java.lang.String nsUri
          Full namespace uri for the element.
 boolean openTagEnded
          Set to false if the closing bracket of the element's start tag has been written (i.e.
 int repeatingCount
          Indicates the number of repeating child elements written within the scope of the current XmlWriter.startRepeatingElement() / XmlWriter.endRepeatingElement() pair for this element.
 int repeatingIndex
          If an element is a part of a series of repeating element within its parent, this will contain the zero-based index of the child, else the value will be NOT_REPEATING.
 boolean unformattedChildren
          True if this element contains unformatted children (text nodes, raw blobs of XML, or unescaped strings.
 java.lang.String xmlLang
          xml:lang attribute of the element.
 
Constructor Summary
protected XmlWriter.Element(java.lang.String nsAlias, java.lang.String nsUri, java.lang.String name)
          Constructs an element.
 
Method Summary
 void addNamespace(XmlNamespace ns)
          Adds a namespace declaration to the element, avoiding duplicates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_REPEATING

public static final int NOT_REPEATING
Sentinel value used for repeating elements.

See Also:
repeatingCount, repeatingIndex, Constant Field Values

nsDecls

public java.util.List<XmlNamespace> nsDecls
Namespace declarations associated with this element.


nsAlias

public java.lang.String nsAlias
Namespace prefix for the element.


nsUri

public final java.lang.String nsUri
Full namespace uri for the element.


name

public final java.lang.String name
Local name of the element.


xmlLang

public java.lang.String xmlLang
xml:lang attribute of the element.


hasAttributes

public boolean hasAttributes
True if the element has attributes.


unformattedChildren

public boolean unformattedChildren
True if this element contains unformatted children (text nodes, raw blobs of XML, or unescaped strings.


repeatingCount

public int repeatingCount
Indicates the number of repeating child elements written within the scope of the current XmlWriter.startRepeatingElement() / XmlWriter.endRepeatingElement() pair for this element. The value will be NOT_REPEATING if not currently writing repeating elements.


repeatingIndex

public int repeatingIndex
If an element is a part of a series of repeating element within its parent, this will contain the zero-based index of the child, else the value will be NOT_REPEATING.


enclosingDefaultNamespace

public java.lang.String enclosingDefaultNamespace
The default namespace uri that will be active after closure of this element. If null, indicates that the default namespace for the enclosing scope is the same as for the element scope.


openTagEnded

public boolean openTagEnded
Set to false if the closing bracket of the element's start tag has been written (i.e. if XmlWriter.writeOpenTagEnd() has been called yet). Used to optimized elements that have no nested content or children.

Constructor Detail

XmlWriter.Element

protected XmlWriter.Element(java.lang.String nsAlias,
                            java.lang.String nsUri,
                            java.lang.String name)
Constructs an element. This constructor should never be directly called, always use the XmlWriter.createElement(String, String, String) method to create new elements.

Method Detail

addNamespace

public void addNamespace(XmlNamespace ns)
Adds a namespace declaration to the element, avoiding duplicates.