I'm no expert, but I'm planning to do this. You can use xpointer to avoid a
calling eval (though I don't know whether or not it calls eval under the
covers. https://docs.marklogic.com/xp .
Be aware that all xpath evaluations give access to any document in your
database because /doc("anyDocInYourDB.xml") is valid xpath. So do it only
if your document permissions are *exactly* as you need them.
There may be other security ramifications that I don't know about. It
would be great if someone more knowledgeable chimed in about this.
On Fri, Apr 26, 2013 at 12:10 PM, Hubert A Le Van Gong
<[email protected]>wrote:
> Hello MarkLogic experts,
>
> This may be a very stupid question but is there a way for a web service to
> use an XPath expression with the REST API search?
>
> For instance one with an axis like:
> //ResourceTypeX[descendant-or-self::node()="urn:anotherelementid:xyz"]
>
> I was hoping to be able to do something like
> localhost:8003://v1/search?q=my_xpath_expression
>
> Also I need to massage the response so it includes the actual resource
> content and aggregate
> them in a container (defined as a list of the resource type elements
> returned). I'm wondering
> if writing extension(s) to the REST API (my web service also supports
> regular CRUD operations
> on XML documents) is the right approach?
> If I do so, can I call the MarkLogic REST API from within my extension
> point (to retrieve or search docs etc.)?
>
> Or should I look into mapping pre-defined XPath expressions into
> structured queries?
> I was hoping to use the REST API (using search or keyvalue) but I'm not
> convinced this is going to work.
>
> Any hints most appreciated!
>
> Thanks,
> Hubert
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general