Child pages
  • ImplementationTypes
Skip to end of metadata
Go to start of metadata

Implementation Types

Mappings are based on expression rules which may be specified using different syntaxes. These expressions are parsed and applied to nodes context by pluggable engines bundled in xStructure plugin. Implementation type is specified in mapping definition file, through attribute implType on root element.

Two implementations are supported :

  • default : the default implementation, based on regular expressions
  • xpath : an implementation based on XPath

Following examples will be based on this file :

Default implementation

This implementation uses regular expressions to match nodes. Expressions for labels and tooltips look like simplified XPath.

This is the recommended implementation since it's simple to use and performant. Main drawback is that matching rules are not as rich as XPath rules.

Match rule

Expression for match rule is related to the absolute path of node, e.g. : /users/user/identity. You have to define a regular expression (according to Java syntax) which matches this path.

Here are expressions which would match /users/user/identity

Icon
  • /users/user/identity
  • /users/user/.*
  • /users/.*/identity
  • /users/user/(identity|membership)
  • ./user/.

Label/Tooltip expressions

Expressions used to display text are based on relative paths from the current node. They look like XPath expression, with simpler syntax, supporting attributes or tag values. An expression may be composed of multiple paths to resolve, and litteral text. To distinguish paths from litteral text, paths must be enclosed by brackets {...}. Resolution engine will only resolve expressions between brackets.

Syntax rules :

  • a child node is referenced by its name
  • descendant children are separated by / character
  • an attribute is referenced by its name with @ prefix
  • to be resolved, context paths must be enclosed by brackets
  • any text not enclosed by brackets is displayed as is.

Here are expresssions which could apply to /users/user

Icon
  • {login}
  • {@id}
  • {identity/last-name}
  • {identity@title} "{identity/first-name} {identity/last-name}"

To display the matched tag value, use the {.} syntax.

XPath implementation

Warning

Icon

XPath implementation is experimental !
XPath should be the natural way to define expressions to match or build text, but it's quite slower than default implementation. Besides, its syntax is more complex for newbies. I'll investigate to try to improve this implementation.

Requirements

XPath implementation is based on XPathView plugin. This plugin provides a bridge to resolve XPath expressions from XML file content. You'll have to install this plugin to use XPath implementation.

Match rule

Match rule follows syntax defined for default implementation. Why ? Because applying an XPath expression on whole file for each node rendering takes too much time.
Have to think about how I could resolve this...

Label/Tooltip expressions

Here you can use an XPath expression (smile) It should follow XPath 1.0 syntax. Context node is the matched node.

Here are expresssions which could apply to /users/user

Icon
  • ./*[name()='login']/text()
  • @id
  • ./*[name()='login']/last-name/text()
  • concat(./[name()='identity']/@title, ' "', ./[name()='identity']/[name()='first-name']/text(), ' ', ./[name()='identity']/*[name()='last-name']/text(), '"')
  • No labels

3 Comments

  1. Anonymous

    supra shoes blog gateway station has a large area whether from traffic or from the weight in terms of resources the advantages are unparalleled

  2. Anonymous

    When you can feel the things you,coach stores want to feel able to say what you feel when this is a very happy time.

  3. Anonymous

    cheap jordans  Nothing can make me so crazy