org.jbind.xml.instance.impl
Class TextImpl

java.lang.Object
  extended byorg.jbind.xml.instance.impl.Impl
      extended byorg.jbind.xml.instance.impl.TextImpl
All Implemented Interfaces:
IHasLocation, IImpl, IImplChild, IImplWithText, ITextImpl

public class TextImpl
extends Impl
implements ITextImpl


Constructor Summary
TextImpl(IImplContainer aParent, ITextContentProvider aText, ILocation aLocation)
           
TextImpl(IImplContainer aParent, java.lang.String aText, ILocation aLocation)
           
 
Method Summary
 void accept(IDataImplVisitor aVisitor)
           
 IAnyTypeData getAttributeData(java.lang.String aNamespace, java.lang.String aLocalName)
          Gets the data object of an attribute.
 IImplContainer getParentImpl()
           
 java.util.Map getPrefixToNamespaceMapping()
          Gets the prefix to namespace mapping.
 java.lang.String getTextContent()
          Gets the textual content.
 boolean hasTextContent()
          Checks if the implementation has textual content.
 boolean isDefault()
          Checks if the data implementation is a default value or if a value was assigned explicitly.
 boolean isNil()
          Indicates if the data implementation was assigned "nil".
 java.util.ListIterator iterChildren()
          Iterates the children.
 java.util.ListIterator iterElementData(java.lang.String aNamespace, java.lang.String aLocalName)
          Iterates the data objects for the specified namespace and element name.
 void restoreTextContent(ITextContentMemento aMemento)
           
 ITextContentMemento saveTextContent()
           
 void setTextContent(ITextContentProvider aTextContentProvider)
          Sets the textual content by specifiying a provider for lazy evaluation.
 void setTextContent(java.lang.String aString)
          Sets the textual content.
 
Methods inherited from class org.jbind.xml.instance.impl.Impl
getLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jbind.xml.base.IHasLocation
getLocation
 

Constructor Detail

TextImpl

public TextImpl(IImplContainer aParent,
                java.lang.String aText,
                ILocation aLocation)

TextImpl

public TextImpl(IImplContainer aParent,
                ITextContentProvider aText,
                ILocation aLocation)
Method Detail

accept

public void accept(IDataImplVisitor aVisitor)
            throws XmlException
Specified by:
accept in interface IImpl
Throws:
XmlException

getParentImpl

public IImplContainer getParentImpl()
Specified by:
getParentImpl in interface IImplChild

getAttributeData

public IAnyTypeData getAttributeData(java.lang.String aNamespace,
                                     java.lang.String aLocalName)
Description copied from interface: IImpl
Gets the data object of an attribute.

Specified by:
getAttributeData in interface IImpl
Parameters:
aNamespace - (required).
aLocalName - (required).
Returns:
(optional).

isDefault

public boolean isDefault()
Description copied from interface: IImplWithText
Checks if the data implementation is a default value or if a value was assigned explicitly.

Specified by:
isDefault in interface IImplWithText
Returns:
Returns true iff the data implementation is a default value.

isNil

public boolean isNil()
Description copied from interface: IImpl
Indicates if the data implementation was assigned "nil".

Specified by:
isNil in interface IImpl
Returns:
Returns true iff the data implementation was assigned "nil".

iterChildren

public java.util.ListIterator iterChildren()
Description copied from interface: IImpl
Iterates the children.

Specified by:
iterChildren in interface IImpl
Returns:
(required). A list iterator of IImpl.

iterElementData

public java.util.ListIterator iterElementData(java.lang.String aNamespace,
                                              java.lang.String aLocalName)
Description copied from interface: IImpl
Iterates the data objects for the specified namespace and element name.

Specified by:
iterElementData in interface IImpl
Parameters:
aNamespace - (required).
aLocalName - (required).
Returns:
(required). An iterator of IAnyTypeData.

getPrefixToNamespaceMapping

public java.util.Map getPrefixToNamespaceMapping()
Description copied from interface: IImpl
Gets the prefix to namespace mapping.

Specified by:
getPrefixToNamespaceMapping in interface IImpl
Returns:
(required).

hasTextContent

public boolean hasTextContent()
Description copied from interface: IImplWithText
Checks if the implementation has textual content. This method is used to decide if a default value should be used or not.

Attribute implementations will always return true because attributes take their default values only if they are not present in the instance.

Element implementation will return true iff their text content is null or equal to the empty string. In other words the default value of an element is used when the element is empty. (cf. the note at W3C XML-Schema-Structure specification section 3.1.1).

Specified by:
hasTextContent in interface IImplWithText
Returns:
Returns true iff there is textual content.

restoreTextContent

public void restoreTextContent(ITextContentMemento aMemento)
Specified by:
restoreTextContent in interface IImplWithText

saveTextContent

public ITextContentMemento saveTextContent()
Specified by:
saveTextContent in interface IImplWithText

getTextContent

public java.lang.String getTextContent()
Description copied from interface: IImplWithText
Gets the textual content. The textual content corresponds to the lexical value of a data object. For data implementations of attributes the string that is assigned to the attribute is returned. For data implementations of elements with simple content the string value that is assigned to the simple content is returned. If the simple content is empty then the empty string is returned.

Specified by:
getTextContent in interface IImplWithText
Returns:
(required).

setTextContent

public void setTextContent(ITextContentProvider aTextContentProvider)
Description copied from interface: IImplWithText
Sets the textual content by specifiying a provider for lazy evaluation.

Specified by:
setTextContent in interface IImplWithText
Parameters:
aTextContentProvider - (required).

setTextContent

public void setTextContent(java.lang.String aString)
Description copied from interface: IImplWithText
Sets the textual content. The textual content corresponds to the lexical value of a data object.

Specified by:
setTextContent in interface IImplWithText
Parameters:
aString - (required).