com.smallx.xml.infoset.memory
Class MemoryElement

java.lang.Object
  extended bycom.smallx.xml.infoset.memory.MemoryItem
      extended bycom.smallx.xml.infoset.memory.MemoryParent
          extended bycom.smallx.xml.infoset.memory.MemoryElement
All Implemented Interfaces:
Child, Element, Item, Location, Named, Parent, Prefixed, Validity

public class MemoryElement
extends MemoryParent
implements Element


Field Summary
protected  java.util.Map attributes
           
protected  int column
           
protected  int index
           
protected  int line
           
protected  Name name
           
protected  MemoryNamespaceDataProxy nsProxy
           
protected  java.lang.String prefix
           
protected  NamespaceScope scope
           
protected  TypeDefinition typeDefinition
           
protected  int validationAttempted
           
protected  int validity
           
 
Fields inherited from class com.smallx.xml.infoset.memory.MemoryParent
baseURI, children
 
Fields inherited from class com.smallx.xml.infoset.memory.MemoryItem
infoset, origin, ranking
 
Fields inherited from interface com.smallx.xml.infoset.Element
TYPE
 
Fields inherited from interface com.smallx.xml.infoset.Item
ANCESTOR_AXIS, ANCESTOR_OR_SELF_AXIS, ATTRIBUTE, ATTRIBUTE_AXIS, CHARACTERS, CHILD_AXIS, COMMENT, DESCENDANT_AXIS, DESCENDANT_OR_SELF_AXIS, DOCUMENT, DOCUMENT_END, ELEMENT, ELEMENT_END, FOLLOWING_AXIS, FOLLOWING_SIBLING_AXIS, N_TYPES, NAMESPACE, NAMESPACE_AXIS, PARENT_AXIS, PRECEDING_AXIS, PRECEDING_SIBLING_AXIS, PROCESSING_INSTRUCTION, SELF_AXIS
 
Fields inherited from interface com.smallx.xml.infoset.Validity
ATTEMPTED_FULL, ATTEMPTED_NONE, ATTEMPTED_PARTIAL, INVALID, NOT_KNOWN, VALID
 
Constructor Summary
MemoryElement(Infoset infoset, java.net.URI base, Name name, NamespaceScope scope)
           
MemoryElement(Infoset infoset, java.net.URI base, Parent origin, Name name)
           
 
Method Summary
 void addNamespaceBinding(java.lang.String prefix, java.net.URI namespace)
          Sets the default namespace locally.
 Characters appendCharacters(java.lang.String data)
          Appends a data object to the end of the children content.
 Characters appendData(java.lang.Object data)
          Appends a data object to the end of the children content.
 Element appendElement(Name name)
          Appends a new element to the end of the children content.
 Element appendElement(java.lang.String local)
          Appends a new element to the end of the children content.
 Attribute getAttribute(Name name)
          Gets an attribute by name.
 Attribute getAttribute(java.lang.String local)
          Gets an attribute by an unqualified name.
 java.util.Iterator getAttributes()
          Returns all the attributes specified on this element.
 java.lang.String getAttributeValue(Name name)
          Gets an attribute value by name.
 java.lang.String getAttributeValue(java.lang.String name)
          Gets an attribute value by an unqualified name.
 java.util.Iterator getAttributeValueTokenized(Name name)
          Gets an attribute value by name.
 java.util.Iterator getAttributeValueTokenized(java.lang.String name)
          Gets an attribute value by an unqualified name.
 java.util.Iterator getAxis(byte type)
           
 int getColumn()
           
 Child getFollowingSibling()
          Returns the following sibling of this node.
 java.util.Iterator getFollowingSiblings()
           
 java.util.Iterator getInScopeNamespaces()
           
 int getLine()
           
 Name getName()
          Return the name of the object.
 NamespaceScope getNamespaceScope()
          Returns the namespace scope associated with this element.
 java.lang.String getNormalizedText()
           
 Child getPrecedingSibling()
          Returns the preceeding sibling to this node.
 java.util.Iterator getPrecedingSiblings()
           
 java.lang.String getPrefix()
           
 java.lang.String getText()
           
 byte getType()
          Returns the type of type node.
 TypeDefinition getTypeDefinition()
          Returns a type definition from the schema implementation.
 int getValidationAttempted()
           
 int getValidity()
          Gets the validity.
 boolean hasAttributes()
           
 boolean hasNamespaceDeclarations()
          Signals that the namespace scope is local to this node and not the parent's namespace scope.
 Child insertCharactersBefore(int index, java.lang.String value)
          Inserts a data object into the children content.
 Child insertDataBefore(int index, java.lang.Object data)
          Inserts a data object into the children content.
 Element insertElementBefore(int index, Name name)
          Inserts a new element to the end of the children content.
 Element insertElementBefore(int index, java.lang.String local)
          Inserts a new element into the children content.
 boolean isSpacePreserving()
          Indicates if the element is set to preserve space.
 void localizeNamespaceDeclarations()
          Localizes all namespace declarations.
 void removeAttribute(Name name)
          Removes an attribute by name.
 void removeAttribute(java.lang.String local)
          Removes an attribute by an unqualified name.
 void setAttribute(Name name, java.lang.String value)
          Sets an attribute value by name.
 void setAttribute(java.lang.String local, java.lang.String value)
          Sets an attribute value by name.
 void setColumn(int column)
           
protected  void setIndex(int index)
           
 void setLine(int line)
           
 void setName(Name value)
          Sets the name of the object.
 void setName(java.lang.String localName)
          Sets the name of the object.
 void setName(java.net.URI namespaceName, java.lang.String localName)
          Sets the name of the object.
 void setPrefix(java.lang.String prefix)
           
 void setTypeDefinition(TypeDefinition typeDef)
          Sets the type definition object for this item.
 void setValidity(int validity, int attempted)
          Sets the validity and validation attempted.
 
Methods inherited from class com.smallx.xml.infoset.memory.MemoryParent
appendChild, getBaseURI, getChildAt, getChildren, getChildrenByType, getNumberOfChildren, getParent, hasChildren, insertChildBefore, removeChild, removeChildAt, setBaseURI, swapChild
 
Methods inherited from class com.smallx.xml.infoset.memory.MemoryItem
compareTo, getDocument, getGeneratedId, getInfoset, getOrigin, setRank
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.smallx.xml.infoset.Parent
appendChild, getBaseURI, getChildAt, getChildren, getChildrenByType, getDocument, getNumberOfChildren, hasChildren, insertChildBefore, removeChild, removeChildAt, setBaseURI, swapChild
 
Methods inherited from interface com.smallx.xml.infoset.Child
compareTo, getParent
 
Methods inherited from interface com.smallx.xml.infoset.Item
getGeneratedId, getInfoset, getOrigin
 

Field Detail

name

protected Name name

prefix

protected java.lang.String prefix

attributes

protected java.util.Map attributes

scope

protected NamespaceScope scope

index

protected int index

nsProxy

protected MemoryNamespaceDataProxy nsProxy

line

protected int line

column

protected int column

typeDefinition

protected TypeDefinition typeDefinition

validity

protected int validity

validationAttempted

protected int validationAttempted
Constructor Detail

MemoryElement

public MemoryElement(Infoset infoset,
                     java.net.URI base,
                     Parent origin,
                     Name name)

MemoryElement

public MemoryElement(Infoset infoset,
                     java.net.URI base,
                     Name name,
                     NamespaceScope scope)
Method Detail

setIndex

protected void setIndex(int index)
Specified by:
setIndex in class MemoryItem

getType

public byte getType()
Description copied from interface: Item
Returns the type of type node.

Specified by:
getType in interface Item

getName

public Name getName()
Description copied from interface: Named
Return the name of the object.

Specified by:
getName in interface Named

setName

public void setName(Name value)
Description copied from interface: Named
Sets the name of the object.

Specified by:
setName in interface Named
Parameters:
value - The name to set.

setName

public void setName(java.lang.String localName)
Description copied from interface: Named
Sets the name of the object.

Specified by:
setName in interface Named
Parameters:
localName - The local name to use and the namespace name is assumed to be URI.NO_NAMESPACE

setName

public void setName(java.net.URI namespaceName,
                    java.lang.String localName)
Description copied from interface: Named
Sets the name of the object.

Specified by:
setName in interface Named
Parameters:
namespaceName - The namespace name to use.
localName - The local name to use.

getPrefix

public java.lang.String getPrefix()
Specified by:
getPrefix in interface Prefixed

setPrefix

public void setPrefix(java.lang.String prefix)
Specified by:
setPrefix in interface Prefixed

hasAttributes

public boolean hasAttributes()
Specified by:
hasAttributes in interface Element

getAttributes

public java.util.Iterator getAttributes()
Description copied from interface: Element
Returns all the attributes specified on this element.

Specified by:
getAttributes in interface Element
Returns:
A iteration of the attributes.

getAttribute

public Attribute getAttribute(Name name)
Description copied from interface: Element
Gets an attribute by name.

Specified by:
getAttribute in interface Element
Parameters:
name - The name of the attribute.
Returns:
An attribute instance or null if the attribute does not exist.

getAttribute

public Attribute getAttribute(java.lang.String local)
Description copied from interface: Element
Gets an attribute by an unqualified name.

Specified by:
getAttribute in interface Element
Parameters:
local - The unqualified name of the attribute.
Returns:
An attribute instance or null if the attribute does not exist.

getAttributeValue

public java.lang.String getAttributeValue(Name name)
Description copied from interface: Element
Gets an attribute value by name.

Specified by:
getAttributeValue in interface Element
Parameters:
name - The name of the attribute.
Returns:
A data value for the attribute or null if the attribute does not exist.

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String name)
Description copied from interface: Element
Gets an attribute value by an unqualified name.

Specified by:
getAttributeValue in interface Element
Parameters:
name - The unqualified name of the attribute.
Returns:
A data value for the attribute or null if the attribute does not exist.

getAttributeValueTokenized

public java.util.Iterator getAttributeValueTokenized(Name name)
Description copied from interface: Element
Gets an attribute value by name.

Specified by:
getAttributeValueTokenized in interface Element
Parameters:
name - The name of the attribute.
Returns:
A data value for the attribute or null if the attribute does not exist.

getAttributeValueTokenized

public java.util.Iterator getAttributeValueTokenized(java.lang.String name)
Description copied from interface: Element
Gets an attribute value by an unqualified name.

Specified by:
getAttributeValueTokenized in interface Element
Parameters:
name - The unqualified name of the attribute.
Returns:
A data value for the attribute or null if the attribute does not exist.

setAttribute

public void setAttribute(Name name,
                         java.lang.String value)
Description copied from interface: Element
Sets an attribute value by name. If the attribute does not exist, it will be create.

Specified by:
setAttribute in interface Element
Parameters:
name - The name of the attribute.
value - The data value to use.

setAttribute

public void setAttribute(java.lang.String local,
                         java.lang.String value)
Description copied from interface: Element
Sets an attribute value by name. If the attribute does not exist, it will be create.

Specified by:
setAttribute in interface Element
Parameters:
local - The unqualified name of the attribute.
value - The data value to use.

removeAttribute

public void removeAttribute(Name name)
Description copied from interface: Element
Removes an attribute by name.

Specified by:
removeAttribute in interface Element
Parameters:
name - The name of the attribute.

removeAttribute

public void removeAttribute(java.lang.String local)
Description copied from interface: Element
Removes an attribute by an unqualified name.

Specified by:
removeAttribute in interface Element
Parameters:
local - The unqualfied name of the attribute.

appendElement

public Element appendElement(Name name)
Description copied from interface: Element
Appends a new element to the end of the children content.

Specified by:
appendElement in interface Element
Parameters:
name - The name of the element to create.
Returns:
An instance of element with the specified name.

appendElement

public Element appendElement(java.lang.String local)
Description copied from interface: Element
Appends a new element to the end of the children content.

Specified by:
appendElement in interface Element
Parameters:
local - The local name to be interpreted by the namespace scope of the element to create.
Returns:
An instance of element with the specified name.

insertElementBefore

public Element insertElementBefore(int index,
                                   Name name)
Description copied from interface: Element
Inserts a new element to the end of the children content.

Specified by:
insertElementBefore in interface Element
Parameters:
index - The index of the position of where to create the element where zero is the beginning of the children content.
name - The name of the element to create.
Returns:
An instance of element with the specified name.

insertElementBefore

public Element insertElementBefore(int index,
                                   java.lang.String local)
Description copied from interface: Element
Inserts a new element into the children content.

Specified by:
insertElementBefore in interface Element
Parameters:
index - The index of the position of where to create the element where zero is the beginning of the children content.
local - The local name to be interpreted by the namespace scope of the element to create.
Returns:
An instance of element with the specified name.

appendData

public Characters appendData(java.lang.Object data)
Description copied from interface: Element
Appends a data object to the end of the children content.

Specified by:
appendData in interface Element
Parameters:
data - The data object to append.
Returns:
An instance of Child that conforms to Data as well.

appendCharacters

public Characters appendCharacters(java.lang.String data)
Description copied from interface: Element
Appends a data object to the end of the children content.

Specified by:
appendCharacters in interface Element
Parameters:
data - The data object to append.
Returns:
An instance of Child that conforms to Data as well.

insertDataBefore

public Child insertDataBefore(int index,
                              java.lang.Object data)
Description copied from interface: Element
Inserts a data object into the children content.

Specified by:
insertDataBefore in interface Element
Parameters:
index - The index of the position of where to create the data child where zero is the beginning of the children content.
data - The data object to append.
Returns:
An instance of Data.

insertCharactersBefore

public Child insertCharactersBefore(int index,
                                    java.lang.String value)
Description copied from interface: Element
Inserts a data object into the children content.

Specified by:
insertCharactersBefore in interface Element
Parameters:
index - The index of the position of where to create the data child where zero is the beginning of the children content.
value - The data object to append.
Returns:
An instance of Data.

getNamespaceScope

public NamespaceScope getNamespaceScope()
Description copied from interface: Element
Returns the namespace scope associated with this element.

Specified by:
getNamespaceScope in interface Element

hasNamespaceDeclarations

public boolean hasNamespaceDeclarations()
Description copied from interface: Element
Signals that the namespace scope is local to this node and not the parent's namespace scope.

Specified by:
hasNamespaceDeclarations in interface Element
Returns:
Returns true if namespace scope is local to this node.

getFollowingSibling

public Child getFollowingSibling()
Description copied from interface: Child
Returns the following sibling of this node.

Specified by:
getFollowingSibling in interface Child
Returns:
An instance of Item or null.

getPrecedingSibling

public Child getPrecedingSibling()
Description copied from interface: Child
Returns the preceeding sibling to this node.

Specified by:
getPrecedingSibling in interface Child

isSpacePreserving

public boolean isSpacePreserving()
Description copied from interface: Element
Indicates if the element is set to preserve space.

Specified by:
isSpacePreserving in interface Element

addNamespaceBinding

public void addNamespaceBinding(java.lang.String prefix,
                                java.net.URI namespace)
Sets the default namespace locally.

Specified by:
addNamespaceBinding in interface Element
Parameters:
namespace - The namespace name to be set as default.

localizeNamespaceDeclarations

public void localizeNamespaceDeclarations()
Description copied from interface: Element
Localizes all namespace declarations. This is useful when mixing element item streams.

Specified by:
localizeNamespaceDeclarations in interface Element

getAxis

public java.util.Iterator getAxis(byte type)
Specified by:
getAxis in interface Item
Overrides:
getAxis in class MemoryParent

getFollowingSiblings

public java.util.Iterator getFollowingSiblings()
Specified by:
getFollowingSiblings in interface Child

getPrecedingSiblings

public java.util.Iterator getPrecedingSiblings()
Specified by:
getPrecedingSiblings in interface Child

getInScopeNamespaces

public java.util.Iterator getInScopeNamespaces()
Specified by:
getInScopeNamespaces in interface Element

getColumn

public int getColumn()
Specified by:
getColumn in interface Location

getLine

public int getLine()
Specified by:
getLine in interface Location

setColumn

public void setColumn(int column)
Specified by:
setColumn in interface Location

setLine

public void setLine(int line)
Specified by:
setLine in interface Location

getText

public java.lang.String getText()
Specified by:
getText in interface Element

getNormalizedText

public java.lang.String getNormalizedText()
Specified by:
getNormalizedText in interface Element

getValidity

public int getValidity()
Description copied from interface: Validity
Gets the validity.

Specified by:
getValidity in interface Validity

getValidationAttempted

public int getValidationAttempted()
Specified by:
getValidationAttempted in interface Validity

setValidity

public void setValidity(int validity,
                        int attempted)
Description copied from interface: Validity
Sets the validity and validation attempted.

Specified by:
setValidity in interface Validity
Parameters:
validity - One of the values VALID, INVALID, or NOT_KNOWN
attempted - One of the values ATTEMPTED_NONE, ATTEMPTED_FULL, or ATTEMPTED_PARTIAL

getTypeDefinition

public TypeDefinition getTypeDefinition()
Description copied from interface: Validity
Returns a type definition from the schema implementation.

Specified by:
getTypeDefinition in interface Validity

setTypeDefinition

public void setTypeDefinition(TypeDefinition typeDef)
Description copied from interface: Validity
Sets the type definition object for this item.

Specified by:
setTypeDefinition in interface Validity