G
gfrommer
Hello Everyone,
I'm writing a server in java, and I want the clients to pass me an
XPath query. I want the XPath queries to be in a specific format
though, I'm pretty sure it's valid but I want your help.
We have several -top level- documents that the user is allowed returned
to them from the query. We don't want them grabbing subchunks of the
XML without that being encased in one of the allowed top documents. For
example, "Person" is the name of one of our top level documents. Is
this query valid?
/Person[/Person/Name="MrCool" AND /Person/Age >42] .... that will
return all Person documents with name "MrCool" and Age > 42, correct?
My REAL question is if we can have very complex predicates in our
XPath, including ()'s to group the parameters, such as:
/Person[ ((/Person/Age > 10 AND /Person/Age < 25) OR
(/Person/Age > 30 AND /Person/Age < 35)) AND
((/Person/Name = "RustyShackleford") OR
(/Person/Name = "DaleGribble")) ]
Is the above query valid? Is there a limit to the length of a
predicate? Also, how do XPath statements (engines) feel about
multi-line XPaths like the one above? Are linebreaks allowed in XPath
statements?
Thanks everyone
I'm writing a server in java, and I want the clients to pass me an
XPath query. I want the XPath queries to be in a specific format
though, I'm pretty sure it's valid but I want your help.
We have several -top level- documents that the user is allowed returned
to them from the query. We don't want them grabbing subchunks of the
XML without that being encased in one of the allowed top documents. For
example, "Person" is the name of one of our top level documents. Is
this query valid?
/Person[/Person/Name="MrCool" AND /Person/Age >42] .... that will
return all Person documents with name "MrCool" and Age > 42, correct?
My REAL question is if we can have very complex predicates in our
XPath, including ()'s to group the parameters, such as:
/Person[ ((/Person/Age > 10 AND /Person/Age < 25) OR
(/Person/Age > 30 AND /Person/Age < 35)) AND
((/Person/Name = "RustyShackleford") OR
(/Person/Name = "DaleGribble")) ]
Is the above query valid? Is there a limit to the length of a
predicate? Also, how do XPath statements (engines) feel about
multi-line XPaths like the one above? Are linebreaks allowed in XPath
statements?
Thanks everyone