Package eu.europa.ted.efx.xpath
Class XPathAttributeLocator
- java.lang.Object
-
- eu.europa.ted.efx.xpath.XPath20BaseListener
-
- eu.europa.ted.efx.xpath.XPathAttributeLocator
-
- All Implemented Interfaces:
XPath20Listener,org.antlr.v4.runtime.tree.ParseTreeListener
public class XPathAttributeLocator extends XPath20BaseListener
Uses theXPath20Parserto extract an attribute from an XPath expression. Arguably one could try to do the same thing using regular expressions, however, with the parser we can handle correctly any XPath expression regardless of how complicated it maybe. The reason we need to examine if an XPath expression points to an attribute is because some eForms Fields represent attribute values. This means that these attributes are effectively hidden behind a Field identifier and cannot be visible by the lexical analyzer or the parser. They are only visible to the translator after dereferencing such Field identifiers. At this point, the translator relies on this class to detect the presence of such attributes and translate accordingly.
-
-
Constructor Summary
Constructors Constructor Description XPathAttributeLocator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidenterPredicate(XPath20Parser.PredicateContext ctx)Enter a parse tree produced byXPath20Parser.predicate().voidexitAbbrevforwardstep(XPath20Parser.AbbrevforwardstepContext ctx)Exit a parse tree produced byXPath20Parser.abbrevforwardstep().voidexitPredicate(XPath20Parser.PredicateContext ctx)Exit a parse tree produced byXPath20Parser.predicate().static XPathAttributeLocatorfindAttribute(Expression.PathExpression xpath)StringgetAttribute()Expression.PathExpressiongetPath()BooleanhasAttribute()-
Methods inherited from class eu.europa.ted.efx.xpath.XPath20BaseListener
enterAbbrevforwardstep, enterAbbrevreversestep, enterAdditiveexpr, enterAndexpr, enterAnykindtest, enterAtomictype, enterAttribnameorwildcard, enterAttributedeclaration, enterAttributename, enterAttributetest, enterAuxilary, enterCastableexpr, enterCastexpr, enterCommenttest, enterComparisonexpr, enterContextitemexpr, enterDocumenttest, enterElementdeclaration, enterElementname, enterElementnameorwildcard, enterElementtest, enterEveryRule, enterExpr, enterExprsingle, enterForexpr, enterForwardaxis, enterForwardstep, enterFunctioncall, enterGeneralcomp, enterIfexpr, enterInstanceofexpr, enterIntersectexceptexpr, enterItemtype, enterKindtest, enterLiteral, enterMultiplicativeexpr, enterNametest, enterNodecomp, enterNodetest, enterNumericliteral, enterOccurrenceindicator, enterOrexpr, enterParenthesizedexpr, enterPathexpr, enterPitest, enterPredicatelist, enterPrimaryexpr, enterQname, enterQuantifiedexpr, enterRangeexpr, enterRelativepathexpr, enterReverseaxis, enterReversestep, enterSchemaattributetest, enterSchemaelementtest, enterSequencetype, enterSimpleforclause, enterSingletype, enterStep, enterStepexpr, enterTexttest, enterTreatexpr, enterTypename_, enterUnaryexpr, enterUnionexpr, enterValuecomp, enterValueexpr, enterVarname, enterVarref, enterWildcard, enterXpath, exitAbbrevreversestep, exitAdditiveexpr, exitAndexpr, exitAnykindtest, exitAtomictype, exitAttribnameorwildcard, exitAttributedeclaration, exitAttributename, exitAttributetest, exitAuxilary, exitCastableexpr, exitCastexpr, exitCommenttest, exitComparisonexpr, exitContextitemexpr, exitDocumenttest, exitElementdeclaration, exitElementname, exitElementnameorwildcard, exitElementtest, exitEveryRule, exitExpr, exitExprsingle, exitForexpr, exitForwardaxis, exitForwardstep, exitFunctioncall, exitGeneralcomp, exitIfexpr, exitInstanceofexpr, exitIntersectexceptexpr, exitItemtype, exitKindtest, exitLiteral, exitMultiplicativeexpr, exitNametest, exitNodecomp, exitNodetest, exitNumericliteral, exitOccurrenceindicator, exitOrexpr, exitParenthesizedexpr, exitPathexpr, exitPitest, exitPredicatelist, exitPrimaryexpr, exitQname, exitQuantifiedexpr, exitRangeexpr, exitRelativepathexpr, exitReverseaxis, exitReversestep, exitSchemaattributetest, exitSchemaelementtest, exitSequencetype, exitSimpleforclause, exitSingletype, exitStep, exitStepexpr, exitTexttest, exitTreatexpr, exitTypename_, exitUnaryexpr, exitUnionexpr, exitValuecomp, exitValueexpr, exitVarname, exitVarref, exitWildcard, exitXpath, visitErrorNode, visitTerminal
-
-
-
-
Method Detail
-
getPath
public Expression.PathExpression getPath()
-
getAttribute
public String getAttribute()
-
hasAttribute
public Boolean hasAttribute()
-
enterPredicate
public void enterPredicate(XPath20Parser.PredicateContext ctx)
Description copied from class:XPath20BaseListenerEnter a parse tree produced byXPath20Parser.predicate().The default implementation does nothing.
- Specified by:
enterPredicatein interfaceXPath20Listener- Overrides:
enterPredicatein classXPath20BaseListener- Parameters:
ctx- the parse tree
-
exitPredicate
public void exitPredicate(XPath20Parser.PredicateContext ctx)
Description copied from class:XPath20BaseListenerExit a parse tree produced byXPath20Parser.predicate().The default implementation does nothing.
- Specified by:
exitPredicatein interfaceXPath20Listener- Overrides:
exitPredicatein classXPath20BaseListener- Parameters:
ctx- the parse tree
-
exitAbbrevforwardstep
public void exitAbbrevforwardstep(XPath20Parser.AbbrevforwardstepContext ctx)
Description copied from class:XPath20BaseListenerExit a parse tree produced byXPath20Parser.abbrevforwardstep().The default implementation does nothing.
- Specified by:
exitAbbrevforwardstepin interfaceXPath20Listener- Overrides:
exitAbbrevforwardstepin classXPath20BaseListener- Parameters:
ctx- the parse tree
-
findAttribute
public static XPathAttributeLocator findAttribute(Expression.PathExpression xpath)
-
-