org.jbind.xml.dom3.core
Class ElementFactoryImpl

java.lang.Object
  extended byorg.jbind.xml.dom3.core.ElementFactoryImpl
All Implemented Interfaces:
IDataImpl, IElementImpl, IHasLocation, IImpl, IImplChild, IImplContainer, IImplWithText

public class ElementFactoryImpl
extends java.lang.Object
implements IElementImpl


Constructor Summary
ElementFactoryImpl()
           
 
Method Summary
 void accept(IDataImplVisitor aVisitor)
           
 IAttributeImpl addAttribute(java.lang.String aNamespace, java.lang.String aQName, ITextContentProvider aProvider, boolean anIsDefault, ILocation aLocation)
           
 IAttributeImpl addAttribute(java.lang.String aNamespace, java.lang.String aQName, java.lang.String aValue, boolean anIsDefault, ILocation aLocation)
          Adds an attribute.
 IElementImpl addElement(java.lang.String aNamespace, java.lang.String aQName)
          Adds a new element.
 IElementImpl addElement(java.lang.String aNamespace, java.lang.String aQName, java.util.Map aPrefixMappings, ILocation aLocation)
          Adds a new element implementation.
 ITextImpl addText(java.lang.String aText, ILocation aLocation)
          Adds a new text implementation.
 IAnyTypeData getAttributeData(java.lang.String aNamespace, java.lang.String aLocalName)
          Gets the data object of an attribute.
 IAttributeImpl getAttributeImpl(java.lang.String aNamespace, java.lang.String aName)
          Gets an attribute implementation.
 IImpl getChild(int anIndex)
           
 IAnyTypeData getData()
           
 ILocation getLocation()
           
 java.lang.String getNamespace()
           
 java.lang.String getNamespaceForPrefix(java.lang.String aPrefix)
          Gets a namespace for a prefix.
 int getNbChildren()
           
 int getNonDefaultedNbChildren()
           
 IImplContainer getParentImpl()
           
 java.lang.String getPartName()
          Gets the attribute or element name.
 java.lang.String getPrefixForNamespace(java.lang.String aNamespace, boolean aCreate)
          Gets a prefix for a namespace.
 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.Iterator iterAttributeImpls()
          Iterates the attribute implementations.
 java.util.Iterator iterAttributes(java.lang.String aNamespace, java.lang.String aName)
          Iterates the attribute data objects for the specified namespace and name.
 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 removeAttribute(java.lang.String aNamespace, java.lang.String aName)
           
 void restoreTextContent(ITextContentMemento aMemento)
           
 ITextContentMemento saveTextContent()
           
 void setData(IAnyTypeData aData)
           
 void setDefaultAttrCreator(IDefaultAttrCreator aCreator)
           
 void setDefaultTextContent(java.lang.String aString)
           
 void setTextContent(ITextContentProvider aTextContentProvider)
          Sets the textual content by specifiying a provider for lazy evaluation.
 void setTextContent(java.lang.String aValue)
          Sets the textual content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementFactoryImpl

public ElementFactoryImpl()
Method Detail

addAttribute

public IAttributeImpl addAttribute(java.lang.String aNamespace,
                                   java.lang.String aQName,
                                   java.lang.String aValue,
                                   boolean anIsDefault,
                                   ILocation aLocation)
Description copied from interface: IElementImpl
Adds an attribute.

Specified by:
addAttribute in interface IElementImpl
Parameters:
aNamespace - (required).
aQName - (required).
aValue - (required).
aLocation - (optional).
Returns:
(required).

addAttribute

public IAttributeImpl addAttribute(java.lang.String aNamespace,
                                   java.lang.String aQName,
                                   ITextContentProvider aProvider,
                                   boolean anIsDefault,
                                   ILocation aLocation)
Specified by:
addAttribute in interface IElementImpl

addElement

public IElementImpl addElement(java.lang.String aNamespace,
                               java.lang.String aQName)
Description copied from interface: IImplContainer
Adds a new element. Calls the method addElement(aNamespace, aName, aPrefixMappings, aLocation) with the prefix mappings of this data implementation and the location set to null.

Specified by:
addElement in interface IImplContainer
Parameters:
aNamespace - (required).

addElement

public IElementImpl addElement(java.lang.String aNamespace,
                               java.lang.String aQName,
                               java.util.Map aPrefixMappings,
                               ILocation aLocation)
Description copied from interface: IImplContainer
Adds a new element implementation.

Specified by:
addElement in interface IImplContainer
Parameters:
aNamespace - (required).
aQName - (required).
aPrefixMappings - (required).
aLocation - (optional).
Returns:
(required). The newly created element implementation.

addText

public ITextImpl addText(java.lang.String aText,
                         ILocation aLocation)
Description copied from interface: IImplContainer
Adds a new text implementation.

Specified by:
addText in interface IImplContainer
Parameters:
aText - (required).
Returns:
(required). The newly created text implementation.

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).

iterAttributes

public java.util.Iterator iterAttributes(java.lang.String aNamespace,
                                         java.lang.String aName)
Description copied from interface: IDataImpl
Iterates the attribute data objects for the specified namespace and name.

Specified by:
iterAttributes in interface IDataImpl
Parameters:
aNamespace - (optional).
aName - (optional).
Returns:
(required). An iterator of IAnyTypeData.

getAttributeImpl

public IAttributeImpl getAttributeImpl(java.lang.String aNamespace,
                                       java.lang.String aName)
Description copied from interface: IElementImpl
Gets an attribute implementation.

Specified by:
getAttributeImpl in interface IElementImpl
Parameters:
aNamespace - (required).
aName - (required).
Returns:
(optional).

getChild

public IImpl getChild(int anIndex)

getLocation

public ILocation getLocation()
Specified by:
getLocation in interface IHasLocation

getNamespace

public java.lang.String getNamespace()
Specified by:
getNamespace in interface IDataImpl

getNamespaceForPrefix

public java.lang.String getNamespaceForPrefix(java.lang.String aPrefix)
Description copied from interface: IElementImpl
Gets a namespace for a prefix.

Specified by:
getNamespaceForPrefix in interface IElementImpl
Parameters:
aPrefix - (required).
Returns:
(optional).

getNbChildren

public int getNbChildren()

getNonDefaultedNbChildren

public int getNonDefaultedNbChildren()

getParentImpl

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

getPartName

public java.lang.String getPartName()
Description copied from interface: IDataImpl
Gets the attribute or element name.

Specified by:
getPartName in interface IDataImpl
Returns:
(required).

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).

getData

public IAnyTypeData getData()
Specified by:
getData in interface IDataImpl

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.

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".

iterAttributeImpls

public java.util.Iterator iterAttributeImpls()
Description copied from interface: IElementImpl
Iterates the attribute implementations.

Specified by:
iterAttributeImpls in interface IElementImpl
Returns:
(required). An iterator of IAttributeImpl.

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.

removeAttribute

public void removeAttribute(java.lang.String aNamespace,
                            java.lang.String aName)
Specified by:
removeAttribute in interface IElementImpl

restoreTextContent

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

saveTextContent

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

setDefaultAttrCreator

public void setDefaultAttrCreator(IDefaultAttrCreator aCreator)
Specified by:
setDefaultAttrCreator in interface IElementImpl

setDefaultTextContent

public void setDefaultTextContent(java.lang.String aString)
Specified by:
setDefaultTextContent in interface IElementImpl

setTextContent

public void setTextContent(java.lang.String aValue)
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:
aValue - (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).

setData

public void setData(IAnyTypeData aData)
Specified by:
setData in interface IDataImpl

accept

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

getPrefixForNamespace

public java.lang.String getPrefixForNamespace(java.lang.String aNamespace,
                                              boolean aCreate)
Description copied from interface: IElementImpl
Gets a prefix for a namespace.

Specified by:
getPrefixForNamespace in interface IElementImpl
Parameters:
aNamespace - (required).
aCreate - If the create parameter is true then a new mapping is created for the prefix if there is not already one.
Returns:
(optional).

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).