boolean shouldProcessCDATASection(final ICDATASection cdataSection) { this.lastEvent = cdataSection; if (this.gatheredModel != null) { this.gatheredModel.gatherCDATASection(cdataSection); return false; } return this.skipBody.processNonElements; }
boolean shouldProcessComment(final IComment comment) { this.lastEvent = comment; if (this.gatheredModel != null) { this.gatheredModel.gatherComment(comment); return false; } return this.skipBody.processNonElements; }
boolean shouldProcessDocType(final IDocType docType) { this.lastEvent = docType; if (this.gatheredModel != null) { this.gatheredModel.gatherDocType(docType); return false; } return this.skipBody.processNonElements; }
void startGatheringDelayedModel( final IOpenElementTag firstTag, final ProcessorExecutionVars processorExecutionVars) { this.modelLevel--; final SkipBody gatheredSkipBody = this.skipBodyByLevel[this.modelLevel]; final boolean gatheredSkipCloseTagByLevel = this.skipCloseTagByLevel[this.modelLevel]; this.gatheredModel = new GatheringModelProcessable( this.configuration, this.processorTemplateHandler, this.context, this, this.templateFlowController, gatheredSkipBody, gatheredSkipCloseTagByLevel, processorExecutionVars); this.gatheredModel.gatherOpenElement(firstTag); }
void startGatheringDelayedModel( final IStandaloneElementTag firstTag, final ProcessorExecutionVars processorExecutionVars) { SkipBody gatheredSkipBody = this.skipBodyByLevel[this.modelLevel]; gatheredSkipBody = (gatheredSkipBody == SkipBody.SKIP_ELEMENTS ? SkipBody.PROCESS_ONE_ELEMENT : gatheredSkipBody); final boolean gatheredSkipCloseTagByLevel = this.skipCloseTagByLevel[this.modelLevel]; this.gatheredModel = new GatheringModelProcessable( this.configuration, this.processorTemplateHandler, this.context, this, this.templateFlowController, gatheredSkipBody, gatheredSkipCloseTagByLevel, processorExecutionVars); this.gatheredModel.gatherStandaloneElement(firstTag); }
boolean shouldProcessUnmatchedCloseElement(final ICloseElementTag closeElementTag) { this.lastEvent = closeElementTag; if (this.gatheredModel != null) { this.gatheredModel.gatherUnmatchedCloseElement(closeElementTag); return false; } return this.skipBody.processNonElements; // We will treat this as a non-element }
boolean shouldProcessXMLDeclaration(final IXMLDeclaration xmlDeclaration) { this.lastEvent = xmlDeclaration; if (this.gatheredModel != null) { this.gatheredModel.gatherXMLDeclaration(xmlDeclaration); return false; } return this.skipBody.processNonElements; }
boolean shouldProcessProcessingInstruction(final IProcessingInstruction processingInstruction) { this.lastEvent = processingInstruction; if (this.gatheredModel != null) { this.gatheredModel.gatherProcessingInstruction(processingInstruction); return false; } return this.skipBody.processNonElements; }
boolean shouldProcessText(final IText text) { this.lastEvent = text; if (this.gatheredModel != null) { this.gatheredModel.gatherText(text); return false; } return this.skipBody.processNonElements; }
boolean shouldProcessCloseElement(final ICloseElementTag closeElementTag) { if (this.gatheredModel != null) { this.gatheredModel.gatherCloseElement(closeElementTag); return false; } this.lastEvent = closeElementTag; decreaseModelLevel(); if (this.skipBody == SkipBody.PROCESS_ONE_ELEMENT) { // This was the first element, the others will be skipped skipBody(SkipBody.SKIP_ELEMENTS); if (this.skipCloseTagByLevel[this.modelLevel]) { this.skipCloseTagByLevel[this.modelLevel] = false; return false; } else { return true; } } if (this.skipCloseTagByLevel[this.modelLevel]) { this.skipCloseTagByLevel[this.modelLevel] = false; return false; } return this.skipBody.processElements; }
boolean shouldProcessOpenElement(final IOpenElementTag openElementTag) { this.secondToLastEvent = this.lastEvent; this.lastEvent = openElementTag; if (this.gatheredModel != null) { this.gatheredModel.gatherOpenElement(openElementTag); return false; } boolean process = this.skipBody.processElements; if (this.skipBody == SkipBody.PROCESS_ONE_ELEMENT) { // This is the first (still unclosed) element, let's save it in case it is iterated this.unskippedFirstElementByLevel[this.modelLevel] = openElementTag; } else if (this.skipBody == SkipBody.SKIP_ELEMENTS && this.unskippedFirstElementByLevel[this.modelLevel] == openElementTag) { // The unskipped first element is being iterated! we should allow its processing skipBody(SkipBody.PROCESS_ONE_ELEMENT); process = true; } increaseModelLevel(openElementTag); return process; }
void startGatheringIteratedModel( final IStandaloneElementTag firstTag, final ProcessorExecutionVars processorExecutionVars, final String iterVariableName, final String iterStatusVariableName, final Object iteratedObject) { SkipBody gatheredSkipBody = this.skipBodyByLevel[this.modelLevel]; gatheredSkipBody = (gatheredSkipBody == SkipBody.SKIP_ELEMENTS ? SkipBody.PROCESS_ONE_ELEMENT : gatheredSkipBody); final boolean gatheredSkipCloseTagByLevel = this.skipCloseTagByLevel[this.modelLevel]; final Text precedingWhitespace = computeWhiteSpacePrecedingIteration(firstTag.getElementDefinition().elementName); this.gatheredModel = new IteratedGatheringModelProcessable( this.configuration, this.processorTemplateHandler, this.context, this, this.templateFlowController, gatheredSkipBody, gatheredSkipCloseTagByLevel, processorExecutionVars, iterVariableName, iterStatusVariableName, iteratedObject, precedingWhitespace); this.gatheredModel.gatherStandaloneElement(firstTag); }
public final void gatherCloseElement(final ICloseElementTag closeElementTag) { if (closeElementTag.isUnmatched()) { gatherUnmatchedCloseElement(closeElementTag); return; } if (this.gatheringFinished) { throw new TemplateProcessingException("Gathering is finished already! We cannot gather more events"); } this.modelLevel--; this.syntheticModel.add(closeElementTag); if (this.modelLevel == 0) { // OK, we are finished gathering, this close tag ends the process this.gatheringFinished = true; } }
void startGatheringIteratedModel( final IOpenElementTag firstTag, final ProcessorExecutionVars processorExecutionVars, final String iterVariableName, final String iterStatusVariableName, final Object iteratedObject) { this.modelLevel--; final SkipBody gatheredSkipBody = this.skipBodyByLevel[this.modelLevel]; final boolean gatheredSkipCloseTagByLevel = this.skipCloseTagByLevel[this.modelLevel]; final Text precedingWhitespace = computeWhiteSpacePrecedingIteration(firstTag.getElementDefinition().elementName); this.gatheredModel = new IteratedGatheringModelProcessable( this.configuration, this.processorTemplateHandler, this.context, this, this.templateFlowController, gatheredSkipBody, gatheredSkipCloseTagByLevel, processorExecutionVars, iterVariableName, iterStatusVariableName, iteratedObject, precedingWhitespace); this.gatheredModel.gatherOpenElement(firstTag); }
boolean shouldProcessStandaloneElement(final IStandaloneElementTag standaloneElementTag) { this.secondToLastEvent = this.lastEvent; this.lastEvent = standaloneElementTag; if (this.gatheredModel != null) { this.gatheredModel.gatherStandaloneElement(standaloneElementTag); return false; } boolean process = this.skipBody.processElements; if (this.skipBody == SkipBody.PROCESS_ONE_ELEMENT) { // This was the first element, the others will be skipped. Let's save it in case it is iterated this.unskippedFirstElementByLevel[this.modelLevel] = standaloneElementTag; skipBody(SkipBody.SKIP_ELEMENTS); process = true; } if (process) { /* * INCREASE THE CONTEXT LEVEL so that all local variables created during the execution of processors * are available for the rest of the processors as well as the body of the tag */ if (this.context != null) { this.context.increaseLevel(); this.context.setElementTag(standaloneElementTag); } } return process; }