yok
yok

Reputation: 25

MarkLogic can't find my xml documents

I am new with MarkLogic and I am studying XQuery. My problem is my documents can't be found by my MarkLogic server.

When I execute it gives me your query returned an empty sequence. can you help me?

enter image description here

enter image description here

Upvotes: 0

Views: 230

Answers (1)

Dave Cassel
Dave Cassel

Reputation: 8422

There are a few things that may be going wrong here.

First, let's confirm that you have loaded the content. In Query Console (which you're using), click the Explore button. If all's well, you should see a list of document URIs in the results section. Copy and paste one of the URIs into your fn:doc-available() command, and you should get true.

If explore didn't show anything, perhaps you accidentally loaded content into a different database. Try changing the Content Source to "Documents", then click explore. Anything there? If not, you can check any other databases you have.

If you're still not seeing data, are you connected to Query Console as the "admin" user? If not, it's possible the user you connected with doesn't have permission to see those documents.

If it's not any of the above, then most likely your document load didn't work. How did you load content into your database?


Edit: the comment below leads me to think that no data has been loaded into the database.

To load a single file just to explore with, you can use xdmp:document-load():

xdmp:document-load("c:\myFile.xml",
  <options xmlns="xdmp:document-load">
    <uri>/documents/myFile.xml</uri>
    <repair>none</repair>
    <permissions>{xdmp:default-permissions()}</permissions>
  </options>)

To load a bunch of documents, take a look at MarkLogic Content Pump.

Before going to much further, I encourage you to take MarkLogic University's Fundamentals course. It's free and available with either a live instructor or in a self-paced format. There are also tutorials available at developer.marklogic.com, including Developing XQuery Applications. If you'd like to skip the setup, check out the Interactive XQuery Playground.

Upvotes: 1

Related Questions