On May 17, 7:47 pm, "John Saunders [MVP]" <john.saunders at
trizetto.comwrote:
<syed.akh...@gmail.comwrote in message
news:11**********************@y80g2000hsf.googlegr oups.com...
Hi,
Does anyone know how can I validate XPath expressions using xsd
schema?
Do you mean that you'd like to validate that the XPath expression matches
something which is valid according to the schema? I don't know of a way to
do that, but if you validate the document first, then there will be nothing
in it which violates the schema. If you then use the XPath expression, and
don't get any exceptions thrown about the form of the expression being bad,
then you could conclude that the expression is valid "according to the
schema".
BTW, I don't believe that the XML Schema Recommendation defines what it
means for an XPath expression to be valid with respect to a schema.
--
John Saunders [MVP]
Thanks for replying.. , yes, you are absolutely right.. I need to
validate the XPath expression according to the schema..
I am actually working on a tool which extract data out of incomming
xml using XPath expressions, these XPath
expressions are inputed into it by some developer(s). Now at XPath
entry time I need to validate them with the schema.
I have a quick and dirty solution myself, that I can generate a fullly
populated sample xml based on xsd
and validate XPath expressions using it. But wanna to look for
something better than that which can work with xsds..
Any suggestions??
Thanks