public final class XmlPatternWorker extends AbstractConversionWorker implements XmlTokenTypes
Modifier and Type | Class and Description |
---|---|
class |
XmlPatternWorker.Library
Helper to create, edit, move and delete XML ASTs.
|
PEER_ID
resolver
ATTR_SET, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, CONTENT, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, INTERNAL_SUBSET, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, PUBLIC_ID, SYSTEM_ID, TEXT_NODE
Constructor and Description |
---|
XmlPatternWorker()
Default constructor which initializes callback library.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
matchAttribute(Aast attrSet,
java.lang.String name,
java.lang.String value)
Scan all attributes in the given attribute set AST and determine
whether any of them match the given name and value parameters.
|
java.lang.Object |
resolveConstant(java.lang.String constant)
Resolve
constant to a literal which can be compiled into
expressions. |
crossReferencePeerAsts, getClosestPeerId, getParentPeer, initializeAst, initializeAst, initializeRootAst, initializeRootAst
finish, getCopy, getLibrary, getSource, initialize, registerTree, setLibrary, visitAst
public XmlPatternWorker()
public java.lang.Object resolveConstant(java.lang.String constant)
constant
to a literal which can be compiled into
expressions.resolveConstant
in interface PatternWorker
resolveConstant
in class AbstractPatternWorker
constant
- Constant indicating a XML token name.private boolean matchAttribute(Aast attrSet, java.lang.String name, java.lang.String value)
The normal AST hierarchy for the value of an attribute is ATTRIBUTE_NODE with a child of type CONTENT. However, there are casess when a TEXT node exists between the ATTRIBUTE_NODE and the CONTENT node. To handle this case, the search is performed in a depth-first way. After the ATTRIBUTE_NODE with the correct name is found, the next CONTENT node in the depth-first traversal will be the value to be checked.
attrSet
- Attribute set AST to scan.name
- Target attribute name to match.value
- Target attribute value to match.true
if the given attribute set contains an
attribute which exactly matches the given name and value;
else false
.