This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I don't understand what you mean when you say you want to "validate" an XPath expression using a schema.
But let's suppose that has some meaning, and carry on. If I understand correctly, you only have the schema and you don't have any XML documents which conform to it. So do you want to find out if the expression would be "valid" (whatever that means) with respect to all possible XML documents which conform to the schema? Or do you want to find out if there is one such XML document? I think we need a clearer description of the problem.
Joined: May 12, 2008
Apologies not for making this clear.
I want to
"only have the schema and don't have any XML documents which conform to it. So want to find out if the expression would be "valid" (whatever that means) with respect to all possible XML documents which conform to the schema "
I can think of ways in which an XPath expression could clearly be "invalid" and you could detect this from the XSD.
For example if the named element simply didn't exist anywhere or if the nesting of elements is wrong. So I suppose you could look at the XSD and determine that a given XPath statement is not demonsterably invalid and therefore MIGHT return a result.
William Brogden wrote:I can think of ways in which an XPath expression could clearly be "invalid" and you could detect this from the XSD.
I am guessing that the business requirement is to determine whether the XPath expression would return a non-empty list of nodes. After all the XPath expression "/fruit/banana" can be evaluated in the context of any XML document and usually it will return zero nodes. But it isn't "invalid" in any formal sense.
But my guess could be wrong. That's why I asked for clarification.
Joined: Apr 16, 2008
What happens when/if a particular schema consists of 100+ files, e.g FpML?