XML Validator - XPath expression
AnsweredHi all,
Could anyone please help me with the "Enter XPath" field on the XML Validator activity? The documentation is not very clear on what this function does. (The documentation says the following:
"In the Enter XPath textbox, enter the XPath of the XML file that you want to validate.")
I have tried several experiments to see what this function does, but can not see any differences in my results.
I'm using simple example XMLs and an example XSD:
<node>
<item>
<name>foo</name>
<note>bar</note>
<quantity>1</quantity>
<price>5.00</price>
</item>
</node>
The XSD already specifies quantity as a positiveInteger, so if I make this a 0 or negative value the validation on the entire XSD fails, as expected.
I tried entering XPath on the price node to make it fail (or only pass-through nodes that don't fail) if this value is not greater than 0:
/node/item[price>0.00]
or
node/item[price>0.00]
This has no effect on the execution or the results, as I expected. The Process Flow just runs and outputs all items, including the ones that contain negative prices. It also just passes if all prices are negative.
Am I expecting the wrong thing?
More information on what this XPath does would be greatly appreciated.
Thank you very much in advance!
PS: I'm currently using Adeptia 6.2 SP2.
Kind regards,
Steven.
-
Official comment
Enter XPath would only validate the XML file path position. It would not be able to perform any filtering respective to the condition as in your condition it would not filter the nodes using /node/item[price>0.00] or node/item[price>0.00] but it would only take the XPath as "node/item" and for filtering as per your conditions then you have to pass it through Data Mapping.
Here's more information regarding the XML Validator
The XML Validator activity is used under conditions where you need to validate the source respective to the xml syntax. You can place the XML file in the XML Validator and if it does not match the XSD, the XML Validator activity would fail and the Process Flow would abort. Also this activity is used when you want to validate any portion of the XML stream.
"Validate XML" checkbox in XML schema would validate the XML against an XSD file during execution. It works only when you use an XSD file to create the XML schema activity. In addition, this schema activity must be used in the process flow (which is generally not required in case of XML format).
Please sign in to leave a comment.
Comments
1 comment