[MarkLogic Dev General] XQuery and Mark Logic Sever
Azam
azam.baig at anovatek.com
Mon Nov 24 05:57:06 PST 2008
Thanks a lot once again
I will work out with the following code and let you know once it is
successfully runs.
Thank you,
Azam.
_____
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Deshbir
Sent: Monday, November 24, 2008 7:25 PM
To: 'General Mark Logic Developer Discussion'
Subject: RE: [MarkLogic Dev General] XQuery and Mark Logic Sever
Assuming your XML document is something like:
<book>
<chapter>..</chapter>
<chapter>..</chapter>
<chapter>..</chapter>
.
</book>
the XQuery for retrieving the 1st chapter would be
doc("<uri of your xml>")/book/chapter[1]
or if you have unique attributes (for example an id) for your chapters:
<book>
<chapter id="."' >..</chapter>
<chapter>..</chapter>
<chapter>..</chapter>
.
</book>
the XQuery for retrieving the 1st chapter could be
doc("<uri of your xml>")/book/chapter[@id="."]
In general, you can assume that XQuery is a superset of Xpath , so almost
any XPath selector would work.
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Azam
Sent: Monday, November 24, 2008 7:02 PM
To: 'General Mark Logic Developer Discussion'
Subject: RE: [MarkLogic Dev General] XQuery and Mark Logic Sever
Thanks a lot.
I will work out on this as I need c#.net code
But one problem as iam new to xquery can you send me the xquery samples
For pulling the xml document named test.xml at a particular node called
"chapter" from Mark logic server
It will be very helpful for me.
Thanks,
Azam
_____
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Deshbir
Sent: Monday, November 24, 2008 6:57 PM
To: 'General Mark Logic Developer Discussion'
Subject: RE: [MarkLogic Dev General] XQuery and Mark Logic Sever
Hi Azam,
Sample code:
========================================
import com.marklogic.xcc.*;
import java.net.*;
//Setup a connection to Mark Logic XDBC server
URI serverUri = new URI ("xcc://" +
userName + ":" +
pass + "@" +
serverIP + ":" +
port);
ContentSource cs = ContentSourceFactory.newContentSource(serverUri);
Session session = cs.newSession();
//Execute XQuery
String strQuery="<Any XQuery>";
Request request = m_objConnectionSession.newAdhocQuery (strQuery);
ResultSequence rs= session.submitRequest(request);
//Retrieve Output of XQuery
String xmlOutput;
if (rs.hasNext())
{
ResultItem item = rs.next();
xmlOutput = item.asInputStream();
}
//Print XML
System.out.println(xmlOutput);
=====================================
Regards.
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Azam
Sent: Monday, November 24, 2008 6:29 PM
To: general at developer.marklogic.com
Subject: [MarkLogic Dev General] XQuery and Mark Logic Sever
Hi,
I have loaded the Xml document in Mark Logic server using the XCC demo
application.
The main task I need to complete is ,
I have to pull the content from the Xml document which I have loaded into
Mark Login server at a particular node using XQUERY and XCC.
As iam very new to XQUERY.
Could you please send me the process or the sample code for the above task.
Its very urgent.
I will be very helpful to you if I through with my task.
Thanks in Advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20081124/9aa6ce5d/attachment-0001.html
More information about the General
mailing list