Top Description Fields Constructors Methods
org.apache.xerces.impl.dtd

pack-priv final Class BalancedDTDGrammar

extends DTDGrammar
Class Inheritance
Imports
org.apache.xerces.util.SymbolTable, org.apache.xerces.xni.Augmentations, .XMLDTDContentModelHandler, .XNIException

A DTD grammar that produces balanced syntax trees.

Author
Michael Glavassevich, IBM
Version
$Id: BalancedDTDGrammar.java 965320 2010-07-18 23:25:54Z mrglavas $

Field Summary

Modifier and TypeField and Description
private int
private int[][]
fGroupIndexStack

Holder for choice/sequence/leaf groups at each depth.

private int[]
fGroupIndexStackSizes

Sizes of the allocated portions of each int[] in fGroupIndexStack.

private boolean
private short[]
fOpStack

Hides org.apache.xerces.impl.dtd.DTDGrammar.fOpStack.

Children content model operation stack.
Inherited from org.apache.xerces.impl.dtd.DTDGrammar:
fAttributeDeclfCurrentAttributeIndexfCurrentElementIndexfDTDContentModelSourcefDTDSourcefElementDeclTabfGrammarDescriptionfReadingExternalDTDnodeIndexprevNodeIndexTOP_LEVEL_SCOPEvalueIndex

Constructor Summary

AccessConstructor and Description
public
BalancedDTDGrammar(SymbolTable symbolTable, XMLDTDDescription desc)

Default constructor.

Method Summary

Modifier and TypeMethod and Description
private int
addContentSpecNodes(int begin, int end)

Creates a subtree from the leaf nodes at the current depth.

protected final void
addContentSpecToElement(XMLElementDecl elementDecl)

Overrides org.apache.xerces.impl.dtd.DTDGrammar.addContentSpecToElement.

Adds the content spec to the given element declaration.
private void
addToCurrentGroup(int
handle to the XMLContentSpec to add to the current group
contentSpec
)

Add XMLContentSpec to the current group.

public final void
element(String
The name of the referenced element.
elementName
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.impl.dtd.DTDGrammar.element.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.element.

A referenced element in a mixed or children content model.
public final void
endDTD(Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.impl.dtd.DTDGrammar.endDTD.

Implements org.apache.xerces.xni.XMLDTDHandler.endDTD.

The end of the DTD.
public final void
endGroup(Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.impl.dtd.DTDGrammar.endGroup.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.endGroup.

The end of a group for mixed or children content models.
private void
initializeContentModelStacks()

Initialize the stacks which temporarily hold content models.

public final void
occurrence(short
The occurrence count for the last element or group.
occurrence
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.impl.dtd.DTDGrammar.occurrence.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.occurrence.

The occurrence count for a child in a children content model or for the mixed content model group.
public final void
pcdata(Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.impl.dtd.DTDGrammar.pcdata.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.pcdata.

The appearance of "#PCDATA" within a group signifying a mixed content model.
public final void
separator(short
The type of children separator.
separator
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.impl.dtd.DTDGrammar.separator.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.separator.

The separator between choices or sequences of a mixed or children content model.
public final void
startContentModel(String
The name of the element.
elementName
,
Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.impl.dtd.DTDGrammar.startContentModel.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.startContentModel.

The start of a content model.
public final void
startGroup(Augmentations
Additional information that may include infoset augmentations.
augs
)

Overrides org.apache.xerces.impl.dtd.DTDGrammar.startGroup.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.startGroup.

A start of either a mixed or children content model.
Inherited from org.apache.xerces.impl.dtd.DTDGrammar:
addContentSpecNodeaddContentSpecNodeaddUniqueLeafNodeanyattributeDeclcommentcreateAttributeDeclcreateContentSpeccreateElementDeclcreateEntityDeclcreateNotationDeclelementDeclemptyendAttlistendConditionalendContentModelendExternalSubsetendParameterEntityexternalEntityDeclgetAttributeDeclgetAttributeDeclIndexgetAttributeDeclIsExternalgetContentSpecgetContentSpecAsStringgetContentSpecIndexgetContentSpecTypegetDTDContentModelSourcegetDTDSourcegetElementContentModelValidatorgetElementDeclgetElementDeclIndexgetElementDeclIndexgetElementDeclIsExternalgetElementDeclNamegetEntityDeclgetEntityDeclIndexgetFirstAttributeDeclIndexgetFirstElementDeclIndexgetGrammarDescriptiongetNextAttributeDeclIndexgetNextElementDeclIndexgetNotationDeclgetNotationDeclIndexgetSymbolTableignoredCharactersinitializeContentModelStackinternalEntityDeclisCDATAAttributeisEntityDeclaredisEntityUnparsedisImmutableisNamespaceAwarenotationDeclprintAttributesprintElementsprocessingInstructionputElementNameMappingsetAttributeDeclsetContentSpecsetContentSpecIndexsetDTDContentModelSourcesetDTDSourcesetElementDeclsetEntityDeclsetFirstAttributeDeclIndexsetNotationDeclstartAttliststartConditionalstartDTDstartExternalSubsetstartParameterEntitytextDeclunparsedEntityDecl

Field Detail

fDepthback to summary
private int fDepth

Hides org.apache.xerces.impl.dtd.DTDGrammar.fDepth.

Stack depth

fGroupIndexStackback to summary
private int[][] fGroupIndexStack

Holder for choice/sequence/leaf groups at each depth.

fGroupIndexStackSizesback to summary
private int[] fGroupIndexStackSizes

Sizes of the allocated portions of each int[] in fGroupIndexStack.

fMixedback to summary
private boolean fMixed

Hides org.apache.xerces.impl.dtd.DTDGrammar.fMixed.

Mixed.

fOpStackback to summary
private short[] fOpStack

Hides org.apache.xerces.impl.dtd.DTDGrammar.fOpStack.

Children content model operation stack.

Constructor Detail

BalancedDTDGrammarback to summary
public BalancedDTDGrammar(SymbolTable symbolTable, XMLDTDDescription desc)

Default constructor.

Method Detail

addContentSpecNodesback to summary
private int addContentSpecNodes(int begin, int end)

Creates a subtree from the leaf nodes at the current depth.

addContentSpecToElementback to summary
protected final void addContentSpecToElement(XMLElementDecl elementDecl)

Overrides org.apache.xerces.impl.dtd.DTDGrammar.addContentSpecToElement.

Adds the content spec to the given element declaration.

addToCurrentGroupback to summary
private void addToCurrentGroup(int contentSpec)

Add XMLContentSpec to the current group.

Parameters
contentSpec:int

handle to the XMLContentSpec to add to the current group

elementback to summary
public final void element(String elementName, Augmentations augs) throws XNIException

Overrides org.apache.xerces.impl.dtd.DTDGrammar.element.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.element.

A referenced element in a mixed or children content model.

Parameters
elementName:String

The name of the referenced element.

augs:Augmentations

Additional information that may include infoset augmentations.

Exceptions
XNIException:
Thrown by handler to signal an error.
endDTDback to summary
public final void endDTD(Augmentations augs) throws XNIException

Overrides org.apache.xerces.impl.dtd.DTDGrammar.endDTD.

Implements org.apache.xerces.xni.XMLDTDHandler.endDTD.

The end of the DTD.

Parameters
augs:Augmentations

Additional information that may include infoset augmentations.

Exceptions
XNIException:
Thrown by handler to signal an error.
endGroupback to summary
public final void endGroup(Augmentations augs) throws XNIException

Overrides org.apache.xerces.impl.dtd.DTDGrammar.endGroup.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.endGroup.

The end of a group for mixed or children content models.

Parameters
augs:Augmentations

Additional information that may include infoset augmentations.

Exceptions
XNIException:
Thrown by handler to signal an error.
initializeContentModelStacksback to summary
private void initializeContentModelStacks()

Initialize the stacks which temporarily hold content models.

occurrenceback to summary
public final void occurrence(short occurrence, Augmentations augs) throws XNIException

Overrides org.apache.xerces.impl.dtd.DTDGrammar.occurrence.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.occurrence.

The occurrence count for a child in a children content model or for the mixed content model group.

Parameters
occurrence:short

The occurrence count for the last element or group.

augs:Augmentations

Additional information that may include infoset augmentations.

Exceptions
XNIException:
Thrown by handler to signal an error.
See Also
org.apache.xerces.xni.XMLDTDContentModelHandler#OCCURS_ZERO_OR_ONE, org.apache.xerces.xni.XMLDTDContentModelHandler#OCCURS_ZERO_OR_MORE, org.apache.xerces.xni.XMLDTDContentModelHandler#OCCURS_ONE_OR_MORE
pcdataback to summary
public final void pcdata(Augmentations augs) throws XNIException

Overrides org.apache.xerces.impl.dtd.DTDGrammar.pcdata.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.pcdata.

The appearance of "#PCDATA" within a group signifying a mixed content model. This method will be the first called following the content model's startGroup().

Parameters
augs:Augmentations

Additional information that may include infoset augmentations.

Exceptions
XNIException:
Thrown by handler to signal an error.
See Also
startGroup
separatorback to summary
public final void separator(short separator, Augmentations augs) throws XNIException

Overrides org.apache.xerces.impl.dtd.DTDGrammar.separator.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.separator.

The separator between choices or sequences of a mixed or children content model.

Parameters
separator:short

The type of children separator.

augs:Augmentations

Additional information that may include infoset augmentations.

Exceptions
XNIException:
Thrown by handler to signal an error.
See Also
org.apache.xerces.xni.XMLDTDContentModelHandler#SEPARATOR_CHOICE, org.apache.xerces.xni.XMLDTDContentModelHandler#SEPARATOR_SEQUENCE
startContentModelback to summary
public final void startContentModel(String elementName, Augmentations augs) throws XNIException

Overrides org.apache.xerces.impl.dtd.DTDGrammar.startContentModel.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.startContentModel.

The start of a content model. Depending on the type of the content model, specific methods may be called between the call to the startContentModel method and the call to the endContentModel method.

Parameters
elementName:String

The name of the element.

augs:Augmentations

Additional information that may include infoset augmentations.

Exceptions
XNIException:
Thrown by handler to signal an error.
startGroupback to summary
public final void startGroup(Augmentations augs) throws XNIException

Overrides org.apache.xerces.impl.dtd.DTDGrammar.startGroup.

Implements org.apache.xerces.xni.XMLDTDContentModelHandler.startGroup.

A start of either a mixed or children content model. A mixed content model will immediately be followed by a call to the pcdata() method. A children content model will contain additional groups and/or elements.

Parameters
augs:Augmentations

Additional information that may include infoset augmentations.

Exceptions
XNIException:
Thrown by handler to signal an error.
See Also
any, empty