Xpath Query
  • 14 Aug 2023
  • 1 Minute to read
  • Dark
    Light

Xpath Query

  • Dark
    Light

Article Summary

Step Details

Introduced in Version---
Last Modified in Version7.12.0
LocationData > XML

The XPath Query step is a data processing step in which an XPath expression is used to select specific nodes or node sets from an XML document. XPath is a query language for navigating and extracting data from XML structures. Utilize the XPath Query to easily pinpoint and retrieve the desired data elements from within the XML document, making it a valuable tool for XML processing tasks such as data extraction, manipulation, and filtering.


Properties

Inputs

PropertyDescriptionData Type
To QuerySpecify the string-based path of the XML document or XML data on which the XPath query will be executed.Object
XpathThe XPath expression that defines the path or steps to select specific nodes or node sets within the XML document. The XPath expression should be in accordance with the XPath language specifications.String

Outputs

PropertyDescriptionData Type
XPath Query ResultThe result of the XPath query execution. It includes the selected nodes or node sets from the XML document based on the provided XPath expression.List of String

Query

PropertyDescriptionData Type
Get XPath from InputExtract the XPath expression from an input field or variable. It is useful to dynamically set the XPath at runtime based on external inputs or conditions.Boolean

XpathThis setting manually specifies the XPath expression when "Get XPath from Input" is not enabled.String
NamespacesProvide a Prefix and URI.---
Return XMLIf enabled, the output will be in XML format, preserving the structure of the selected nodes or node sets.Boolean

Return TypeThis gives the option to return the data in the chosen preferred type. Only Available if Return XML is not set to true. ---


Common Errors

Data at the root level is invalid.

The following error message indicates that there is an issue with parsing an XML document. The error specifically mentions, "Data at the root level is invalid. Line 1, position 1." This usually indicates that the XML data being processed is not well-formed, meaning it doesn't adhere to the XML syntax rules.

Exception Message:

Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step XPath Query 1[XPathQueryStep] in flow [Display Steps]: Data at the root level is invalid. Line 1, position 1.
 ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1. at System.Xml.XmlTextReaderImpl.Throw(Exception e
 at System.Xml.XmlTextReaderImpl.Throw(String res, String arg
 at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace(
 at System.Xml.XmlTextReaderImpl.ParseDocumentContent(
 at System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader, XmlSpace space
 at System.Xml.XPath.XPathDocument..ctor(TextReader textReader
 at DecisionsFramework.Design.Flow.CoreSteps.XML.XPathQueryStep.Run(StepStartData data
 at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData
 at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData)

Was this article helpful?

What's Next