Parasol Framework
  • Gallery
  • API
  • Wiki
  • GitHub
    •  Overview
    • Compile()
    • Evaluate()
    • Query()
    • Audio
    • Core
    • Display
    • Fluid
    • Font
    • Network
    • Regex
    • Vector
    • XML
    • XPath
      • Audio
      • Sound
      • File
      • MetaClass
      • Module
      • StorageDevice
      • Task
      • Thread
      • Time
      • Compression
      • CompressedStream
      • Config
      • Script
      • XML
      • Controller
      • BlurFX
      • ColourFX
      • CompositeFX
      • ConvolveFX
      • DisplacementFX
      • FilterEffect
      • FloodFX
      • ImageFX
      • LightingFX
      • MergeFX
      • MorphologyFX
      • OffsetFX
      • RemapFX
      • SourceFX
      • TurbulenceFX
      • WaveFunctionFX
      • Scintilla
      • ScintillaSearch
      • Bitmap
      • Clipboard
      • Display
      • Document
      • Font
      • Picture
      • Pointer
      • Surface
      • SVG
      • ClientSocket
      • HTTP
      • NetClient
      • NetLookup
      • NetSocket
      • Proxy
      • Vector
      • VectorClip
      • VectorColour
      • VectorEllipse
      • VectorFilter
      • VectorGradient
      • VectorGroup
      • VectorImage
      • VectorPath
      • VectorPattern
      • VectorPolygon
      • VectorRectangle
      • VectorScene
      • VectorShape
      • VectorSpiral
      • VectorText
      • VectorTransition
      • VectorViewport
      • VectorWave
      • Linux Builds
      • Windows Builds
      • Customising Your Build
      • Parasol Objects
      • Parasol In Depth
      • Fluid Reference Manual
      • Common API
      • FileSearch API
      • GUI API
      • JSON API
      • VFX API
      • Widgets
      • RIPL Reference Manual
      • Parasol Cmd Tool
      • Flute / Unit Testing
      • Embedded Document Format
      • FDL Reference Manual
      • FDL Tools
      • Action Reference Manual
      • System Error Codes

XPath Module

Functions

Compile | Evaluate | Query

Structures

XPathNode

Constants

XPathNodeType

Compile()

Compiles an XPath or XQuery expression into an executable form.

ERR xp::Compile(objXML * XML, CSTRING Query, struct XPathNode ** Result)
ParameterDescription
XMLThe XML document context for the query (can be NULL if not needed).
QueryA valid XPath or XQuery expression string.
ResultReceives a pointer to an XPathNode object on success.

Call the Compile function to convert a valid XPath or XQuery expression string into a compiled form that can be executed against an XML document. The resulting compiled expression can be reused multiple times for efficiency and must be freed using FreeResource when no longer needed. They are re-usable between different XML documents and are treated as read-only for thread-safety.

The XML parameter is not required for compilation, but can potentially enhance syntax checking when parsing the expression. An additional benefit is that error messages will be defined in the #ErrorMsg field of the XML object if parsing fails.

Error Codes

OkayOperation successful.
NullArgsFunction call missing argument value(s)
XPath module documentation © Paul Manias © 2025

Evaluate()

Evaluates a compiled XPath or XQuery expression against an XML document.

ERR xp::Evaluate(objXML * XML, struct XPathNode * Query, struct XPathValue ** Result)
ParameterDescription
XMLThe XML document to evaluate the query against.
QueryThe compiled XPath or XQuery expression.
ResultReceives the result of the evaluation.

Use Evaluate to run a previously compiled XPath or XQuery expression against an XML document. The result of the evaluation is returned in the Result parameter as !XPathValue, which can represent various types of data including node sets, strings, numbers, or booleans.

Error Codes

OkayOperation successful.
NullArgsFunction call missing argument value(s)
XPath module documentation © Paul Manias © 2025

Query()

For node-based queries, evaluates a compiled expression and calls a function for each matching node.

ERR xp::Query(objXML * XML, struct XPathNode * Query, FUNCTION * Callback)
ParameterDescription
XMLThe XML document to evaluate the query against.
QueryThe compiled XPath or XQuery expression.
CallbackPointer to a callback function that will be called for each matching node. Can be NULL if searching for the first matching node.

Use the Query function to scan an XML document for tags or attributes that match a compiled XPath or XQuery expression. For every matching node, a user-defined callback function is invoked, allowing custom processing of each result.

If no callback is provided, the search stops after the first match and the XML object's cursor markers will reflect the position of the node.

Note that valid function execution can return ERR:Search if zero matches are found.

Error Codes

OkayAt least one matching node was found and processed.
SearchNo matching node was found.
NoDataThe XML document contains no data to search.
SyntaxThe provided query expression has syntax errors.
NullArgsAt least one required parameter was not provided.
XPath module documentation © Paul Manias © 2025

XPathNodeType Type

NameDescription
XPathNodeType::AXIS_SPECIFIER
XPathNodeType::BINARY_OP
XPathNodeType::CONDITIONAL
XPathNodeType::EXPRESSION
XPathNodeType::FILTER
XPathNodeType::FLWOR_EXPRESSION
XPathNodeType::FOR_BINDING
XPathNodeType::FOR_EXPRESSION
XPathNodeType::FUNCTION_CALL
XPathNodeType::LET_BINDING
XPathNodeType::LET_EXPRESSION
XPathNodeType::LITERAL
XPathNodeType::LOCATION_PATH
XPathNodeType::NAME_TEST
XPathNodeType::NODE_TEST
XPathNodeType::NODE_TYPE_TEST
XPathNodeType::NUMBER
XPathNodeType::PATH
XPathNodeType::PREDICATE
XPathNodeType::PROCESSING_INSTRUCTION_TEST
XPathNodeType::QUANTIFIED_BINDING
XPathNodeType::QUANTIFIED_EXPRESSION
XPathNodeType::ROOT
XPathNodeType::STEP
XPathNodeType::STRING
XPathNodeType::UNARY_OP
XPathNodeType::UNION
XPathNodeType::VARIABLE_REFERENCE
XPathNodeType::WILDCARD
XPath module documentation © Paul Manias © 2025

XPathNode Structure

FieldTypeDescription
XPath module documentation © Paul Manias © 2025