Class XPathFormatter

java.lang.Object
dev.metaschema.core.metapath.format.XPathFormatter
All Implemented Interfaces:
IPathFormatter

public class XPathFormatter extends Object implements IPathFormatter
An IPathFormatter that produces XPath 3.1 expressions with namespace-qualified names using the EQName format (e.g., Q{namespace}localname).

This formatter produces paths suitable for use with XML tooling that requires namespace qualification. The format follows the XPath 3.1 specification for EQNames.

Example output: /Q{http://example.com}catalog/Q{http://example.com}control[1]/@Q{http://example.com}id

For elements with XML grouping (XmlGroupAsBehavior.GROUPED), the wrapper element is included in the path with position [1], followed by the actual element with its position.

See Also:
  • Constructor Details

    • XPathFormatter

      public XPathFormatter()
  • Method Details

    • formatMetaschema

      @NonNull public String formatMetaschema(IModuleNodeItem metaschema)
      Description copied from interface: IPathFormatter
      This visitor callback is used to format an individual metaschema path segment.
      Specified by:
      formatMetaschema in interface IPathFormatter
      Parameters:
      metaschema - the node to format
      Returns:
      the formatted text for the segment
    • formatDocument

      @NonNull public String formatDocument(IDocumentNodeItem document)
      Description copied from interface: IPathFormatter
      This visitor callback is used to format an individual document path segment.
      Specified by:
      formatDocument in interface IPathFormatter
      Parameters:
      document - the node to format
      Returns:
      the formatted text for the segment
    • formatRootAssembly

      @NonNull public String formatRootAssembly(IRootAssemblyNodeItem root)
      Description copied from interface: IPathFormatter
      This visitor callback is used to format a root assembly path segment.
      Specified by:
      formatRootAssembly in interface IPathFormatter
      Parameters:
      root - the node to format
      Returns:
      the formatted text for the segment
    • formatAssembly

      @NonNull public String formatAssembly(IAssemblyNodeItem assembly)
      Description copied from interface: IPathFormatter
      This visitor callback is used to format an individual assembly path segment.
      Specified by:
      formatAssembly in interface IPathFormatter
      Parameters:
      assembly - the node to format
      Returns:
      the formatted text for the segment
    • formatAssembly

      @NonNull public String formatAssembly(IAssemblyInstanceGroupedNodeItem assembly)
      Description copied from interface: IPathFormatter
      This visitor callback is used to format an individual grouped assembly path segment.
      Specified by:
      formatAssembly in interface IPathFormatter
      Parameters:
      assembly - the node to format
      Returns:
      the formatted text for the segment
    • formatField

      @NonNull public String formatField(IFieldNodeItem field)
      Description copied from interface: IPathFormatter
      This visitor callback is used to format an individual field path segment.
      Specified by:
      formatField in interface IPathFormatter
      Parameters:
      field - the node to format
      Returns:
      the formatted text for the segment
    • formatFlag

      @NonNull public String formatFlag(IFlagNodeItem flag)
      Description copied from interface: IPathFormatter
      This visitor callback is used to format an individual flag path segment.
      Specified by:
      formatFlag in interface IPathFormatter
      Parameters:
      flag - the node to format
      Returns:
      the formatted text for the segment