If you're getting a syntax error that just means you have a typo in your code.
If you would send in your code it'd be easier to spot the trouble. Meanwhile,
xdmp:document-delete("/your/uri.xml") will delete a document.
xdmp:node-delete(doc("/your/uri.xml")//author) will delete authors from a
document.
xdmp:node-delete(doc("/your/uri.xml")//author[cts:contains(., "Bob")) will
delete authors having Bob in their name from a document.
This is pretty basic stuff so you should probably read some of the
documentation on XPath, XQuery, and MarkLogic extension functions. Use the
list for questions not easily covered by the docs.
Good luck,
-jh-
On Oct 21, 2013, at 1:36 PM, Vaibhav <[email protected]> wrote:
> Thanks Jason. I have included the mailing list you mentioned. Also I tried
> the code but i am getting
>
> [1.0-ml] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error,
> unexpected QName_
>
> Also how can i mentioned a specific document in the delete code as there any
> be other document nodes with the same author.
>
>
> Thanks,
> VB
>
>
>
>
> On Sat, Oct 19, 2013 at 5:12 PM, Jason Hunter <[email protected]> wrote:
> Hi,
>
> You should join the [email protected] mailing list. This one's
> feedback for MarkMail.
>
> But to answer your question, to delete a node just find the node using XPath
> and call node-delete() on it.
>
> xdmp:node-delete(/msr:product-creators/msr:author[2])
>
> or
>
> xdmp:node-delete(/msr:product-creators/msr:author[cts:contains(., "Linda")])
>
> -jh-
>
>
> > Summary:
> > How to conditionally delete an xml node
> >
> > Details:
> > Hi Guys,
> >
> > I am new to Marklogic and trying to learn basic operations.
> >
> > I have a scenarios where there are multiple nodes with different values.
> >
> > <msr:product-creators>
> > <msr:author display-name="William T. R. Fox">Fox, William
> > T.R.</msr:author>
> > <msr:author display-name="">Adams, Robert Martin</msr:author>
> > <msr:author display-name="">Connor, Linda</msr:author>
> > <msr:author display-name="">Gowin, Emmet</msr:author>
> >
> >
> > Here i want to delete one of the author. How can i do so? I am using CQ to
> > write the xquery.
> > I did research on using xdmp:node-delete but couldn't find how to use
> > conditional delete.
>
>
>
>
> --
> Vaibhav
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general