Package eu.bandm.tools.tdom.runtime
Class UntypedVisitor<E extends TypedElement<E,X>,X extends TypedExtension>
- java.lang.Object
-
- eu.bandm.tools.tdom.runtime.UntypedVisitor<E,X>
-
public class UntypedVisitor<E extends TypedElement<E,X>,X extends TypedExtension> extends java.lang.Object
Visits a tdom Element or Document class in a uniform way, e.g. knows only aboutTypedDocument
,TypedElement
, the different subclasses ofTypedAttribute
.TypedProcessingInstruction
andTypedComment
.
-
-
Field Summary
Fields Modifier and Type Field Description protected E
nearestElement
boolean
validating
If set to false, Attributes with no explicit value will not be visited.
-
Constructor Summary
Constructors Constructor Description UntypedVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
action(E el)
Calls onlydescend(TypedElement)
; can be overridden by the user, if required.void
action(CDataAttribute att)
Does nothing; can be overridden by the user, if required.void
action(IdAttribute att)
Does nothing; can be overridden by the user, if required.void
action(IdRefAttribute att)
Does nothing; can be overridden by the user, if required.void
action(IdRefsAttribute att)
Does nothing; can be overridden by the user, if required.void
action(NmTokenAttribute att)
Does nothing; can be overridden by the user, if required.void
action(NmTokensAttribute att)
Does nothing; can be overridden by the user, if required.void
action(SelectedIntegersAttribute att)
Does nothing; can be overridden by the user, if required.void
action(TypedAttribute a)
Callsmatch(TypedAttribute)
for an attribute.void
action(TypedComment c)
No-operation, can be overridden by the user, if required.void
action(TypedDocument<E,X> doc)
To be overridden by the user.void
action(TypedPCData p)
Calls onlydescend(TypedPCData)
; can be overridden by the user, if required.void
action(TypedProcessingInstruction p)
No-operation, can be overridden by the user, if required.void
descend(E el)
Calls action/match for preceding and leading Ethereals, than attributes, then contents bydescend_contents(TypedElement)
, then trailing and following Ethereals.void
descend(TypedDocument<E,X> doc)
Callsaction(TypedElement)
for the one top-level element.void
descend(TypedPCData p)
void
descend_attributes(TypedElement<E,X> ec)
Callsaction(TypedAttribute)
for some attributes of the element.void
descend_contents(E ec)
Callsmatch(TypedSubstantial)
for all contents.void
descend_followingEthereals(TypedSubstantial<?> ec)
Callsmatch(TypedEthereal)
for all following ethereals.void
descend_leadingEthereals(TypedEtherealContainer ec)
Callsmatch(TypedEthereal)
for all leading ethereals.void
descend_precedingEthereals(TypedSubstantial<?> ec)
Callsmatch(TypedEthereal)
for all preceding ethereals.void
descend_trailingEthereals(TypedEtherealContainer ec)
Callsmatch(TypedEthereal)
for all trailing ethereals.E
getNearestElement()
The last entered element.void
match(TypedAttribute ta)
Calls one of the overloadedaction(X a)
methods for the different subtypes ofTypedAttribute
.void
match(TypedEthereal te)
Distinguishes betweenaction(TypedComment)
andaction(TypedProcessingInstruction)
void
match(TypedSubstantial<X> te)
Distinguishes betweenaction(TypedElement)
andaction(TypedPCData)
.
-
-
-
Field Detail
-
validating
public boolean validating
If set to false, Attributes with no explicit value will not be visited. Explicit value means that the attribute has been present when the model has been created (in source text, SAX event, constructor call), or that it has last been set to a non-null value byattribute.setValue()
.Default value of this field is
true
.
-
nearestElement
protected E extends TypedElement<E,X> nearestElement
-
-
Method Detail
-
getNearestElement
@Opt public E getNearestElement()
The last entered element.- Returns:
- (maybe null) the last entered Element.
-
action
public void action(TypedDocument<E,X> doc)
To be overridden by the user. This default implementation simply callsdescend(TypedDocument)
-
descend
public void descend(TypedDocument<E,X> doc)
Callsaction(TypedElement)
for the one top-level element.
-
match
public void match(TypedSubstantial<X> te)
Distinguishes betweenaction(TypedElement)
andaction(TypedPCData)
.
-
action
public void action(TypedPCData p)
Calls onlydescend(TypedPCData)
; can be overridden by the user, if required.
-
descend
public void descend(TypedPCData p)
-
action
public void action(E el)
Calls onlydescend(TypedElement)
; can be overridden by the user, if required.
-
descend
public void descend(E el)
Calls action/match for preceding and leading Ethereals, than attributes, then contents bydescend_contents(TypedElement)
, then trailing and following Ethereals.
-
descend_contents
public void descend_contents(E ec)
Callsmatch(TypedSubstantial)
for all contents. (This will in turn callaction(TypedElement)
oraction(TypedPCData)
.)
-
descend_leadingEthereals
public void descend_leadingEthereals(TypedEtherealContainer ec)
Callsmatch(TypedEthereal)
for all leading ethereals.
-
descend_trailingEthereals
public void descend_trailingEthereals(TypedEtherealContainer ec)
Callsmatch(TypedEthereal)
for all trailing ethereals.
-
descend_precedingEthereals
public void descend_precedingEthereals(TypedSubstantial<?> ec)
Callsmatch(TypedEthereal)
for all preceding ethereals.
-
descend_followingEthereals
public void descend_followingEthereals(TypedSubstantial<?> ec)
Callsmatch(TypedEthereal)
for all following ethereals.
-
match
public void match(TypedEthereal te)
Distinguishes betweenaction(TypedComment)
andaction(TypedProcessingInstruction)
-
action
public void action(TypedComment c)
No-operation, can be overridden by the user, if required.
-
action
public void action(TypedProcessingInstruction p)
No-operation, can be overridden by the user, if required.
-
descend_attributes
public void descend_attributes(TypedElement<E,X> ec)
Callsaction(TypedAttribute)
for some attributes of the element.
If the global switchvalidating
is true, then all attributes are visited which (a) had been assigned an explicit value when creating the document, or later byTypedAttribute.setValue(V)
, and (b) all those which have a default value in the DTD.
If the global switchvalidating
is false, then only the attributes from case (a) are visited.
-
action
public void action(TypedAttribute a)
Callsmatch(TypedAttribute)
for an attribute. May be overridden.
-
match
public void match(TypedAttribute ta)
Calls one of the overloadedaction(X a)
methods for the different subtypes ofTypedAttribute
.
-
action
public void action(CDataAttribute att)
Does nothing; can be overridden by the user, if required.
-
action
public void action(IdAttribute att)
Does nothing; can be overridden by the user, if required.
-
action
public void action(IdRefAttribute att)
Does nothing; can be overridden by the user, if required.
-
action
public void action(IdRefsAttribute att)
Does nothing; can be overridden by the user, if required.
-
action
public void action(NmTokenAttribute att)
Does nothing; can be overridden by the user, if required.
-
action
public void action(NmTokensAttribute att)
Does nothing; can be overridden by the user, if required.
-
action
public void action(SelectedIntegersAttribute att)
Does nothing; can be overridden by the user, if required.
-
-