APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.serializer

pack-priv final Class ElemContext

extends Object
Class Inheritance

This class is a stack frame that consists of information about the element currently being processed by a serializer. Consider this example:
  
    
    
    
    
  
A stack frame will be pushed for "A" at depth 1, then another one for "B1" at depth 2. Then "B1" stackframe is popped. When the stack frame for "B2" is pushed, this implementation re-uses the old stack fram object used by "B1" to be efficient at not creating too many of these object. This is by no means a public class, and neither are its fields or methods, they are all helper fields for a serializer. The purpose of this class is to be more consistent with pushing information when a new element is being serialized and more quickly restoring the old information about the parent element with a simple pop() when the child element is done. Previously there was some redundant and error-prone calculations going on to retore information.

Field Summary

Modifier and TypeField and Description
pack-priv final int
m_currentElemDepth

The nesting depth of the element inside other elements.

pack-priv ElemDesc
m_elementDesc

HTML field, the element description of the HTML element

pack-priv String
m_elementLocalName

The local name of the element.

pack-priv String
m_elementName

The fully qualified name of the element (with prefix, if any).

pack-priv String
m_elementURI

The URI of the element.

pack-priv boolean
m_isCdataSection

If the element is in the cdata-section-names list then the value is true.

pack-priv boolean
m_isRaw

True if the current element has output escaping disabled.

private ElemContext
m_next

The next element "stack frame".

pack-priv final ElemContext
m_prev

The previous element "stack frame".

pack-priv boolean
m_startTagOpen

Set to true when a start tag is started, or open, but not all the attributes or namespace information is yet collected.

Constructor Summary

AccessConstructor and Description
pack-priv
ElemContext()

Constructor to create the root of the element contexts.

private
ElemContext(final ElemContext
The "stack frame" corresponding to the new elements parent element.
previous
)

Constructor to create the "stack frame" for a given element depth.

Method Summary

Modifier and TypeMethod and Description
pack-priv final ElemContext

Returns:

Returns the parent "stack frame" of the one popped.
pop
()

Pop the current "stack frame".

pack-priv final ElemContext
push()

This method pushes an element "stack frame" but with no initialization of values in that frame.

pack-priv final ElemContext
push(final String
The URI for the namespace for the element name, can be null if it is not yet known.
uri
,
final String
The local name of the element (no prefix), can be null.
localName
,
final String
The qualified name (with prefix, if any) of the element, this parameter is required.
qName
)

Push an element context on the stack.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

m_currentElemDepthback to summary
pack-priv final int m_currentElemDepth

The nesting depth of the element inside other elements.

m_elementDescback to summary
pack-priv ElemDesc m_elementDesc

HTML field, the element description of the HTML element

m_elementLocalNameback to summary
pack-priv String m_elementLocalName

The local name of the element.

m_elementNameback to summary
pack-priv String m_elementName

The fully qualified name of the element (with prefix, if any).

m_elementURIback to summary
pack-priv String m_elementURI

The URI of the element.

m_isCdataSectionback to summary
pack-priv boolean m_isCdataSection

If the element is in the cdata-section-names list then the value is true. If it is true the text children of the element should be output in CDATA section blocks.

m_isRawback to summary
pack-priv boolean m_isRaw

True if the current element has output escaping disabled. This is true for SCRIPT and STYLE elements.

m_nextback to summary
private ElemContext m_next

The next element "stack frame". This value will only be set once as deeper stack frames are not deleted when popped off, but are rather re-used when a push is required. This makes for very fast pushing and popping of stack frames because very few stack frame objects are ever created, they are mostly re-used. This re-use saves object creation but it also means that connections between the frames via m_next and m_prev never changes either. Just the contents of the frames change as they are re-used. Only the reference to the current stack frame, which is held by the serializer is changed via a quick pop() or push().

m_prevback to summary
pack-priv final ElemContext m_prev

The previous element "stack frame".

m_startTagOpenback to summary
pack-priv boolean m_startTagOpen

Set to true when a start tag is started, or open, but not all the attributes or namespace information is yet collected.

Constructor Detail

ElemContextback to summary
pack-priv ElemContext()

Constructor to create the root of the element contexts.

ElemContextback to summary
private ElemContext(final ElemContext previous)

Constructor to create the "stack frame" for a given element depth. This implementation will re-use the context at each depth. If a documents deepest element depth is N then there will be (N+1) such objects created, no more than that.

Parameters
previous:ElemContext

The "stack frame" corresponding to the new elements parent element.

Method Detail

popback to summary
pack-priv final ElemContext pop()

Pop the current "stack frame".

Returns:ElemContext

Returns the parent "stack frame" of the one popped.

pushback to summary
pack-priv final ElemContext push()

This method pushes an element "stack frame" but with no initialization of values in that frame. This method is used for optimization purposes, like when pushing a stack frame for an HTML "IMG" tag which has no children and the stack frame will almost immediately be popped.

pushback to summary
pack-priv final ElemContext push(final String uri, final String localName, final String qName)

Push an element context on the stack. This context keeps track of information gathered about the element.

Parameters
uri:String

The URI for the namespace for the element name, can be null if it is not yet known.

localName:String

The local name of the element (no prefix), can be null.

qName:String

The qualified name (with prefix, if any) of the element, this parameter is required.