If all of your elements are in the http://docbook.org/ns/docbook namespace and 
you don't want to have to bother with the "db:" prefix on every element in your 
XPath, you could try the following alternative:

xquery version "1.0-ml";
(: buffer 2 :)
declare default element namespace "http://docbook.org/ns/docbook";;


doc("/nimas/ch01.xml")/book/chapter/title

Doug Glidden
Software Engineer
The Boeing Company
douglass.a.glid...@boeing.com


  _____

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of David Scott Gurney
Sent: Tuesday, November 03, 2009 23:51
To: General Mark Logic Developer Discussion
Subject: RE: RE: [MarkLogic Dev General] X-path not working in XML Fileshaving 
name space reference!!!!



You might try this:



xquery version "1.0-ml";
(: buffer 2 :)
declare namespace db = "http://docbook.org/ns/docbook";;


doc("/nimas/ch01.xml")/db:book/db:chapter/db:title





The default namespace is http://docbook.org/ns/docbook - thus the need for the 
db namespace



David



From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Mohanraj
Sent: Tuesday, November 03, 2009 9:35 PM
To: general@developer.marklogic.com
Subject: RE: RE: [MarkLogic Dev General] X-path not working in XML Files having 
name space reference!!!!



Hi Geert,

As per the details asked, i have given the data below.

1. Sample XML File

<?xml version="1.0" encoding="UTF-8"?>
<book 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";<http://www.w3.org/2001/XMLSchema-instance>
 
xmlns:qti="http://www.imsglobal.org/xsd/imsqti_v2p1";<http://www.imsglobal.org/xsd/imsqti_v2p1>
 xmlns:dc="http://purl.org/dc/terms/";<http://purl.org/dc/terms/> 
xmlns:xs="http://www.w3.org/2001/XMLSchema";<http://www.w3.org/2001/XMLSchema> 
xmlns:xlink="http://www.w3.org/1999/xlink";<http://www.w3.org/1999/xlink> 
xsi:schemaLocation="http://docbook.org/ns/docbook 
.\hmhdocbook\hmhdocbook.xsd"<http://docbook.org/ns/docbook./hmhdocbook/hmhdocbook.xsd>
 xmlns="http://docbook.org/ns/docbook";<http://docbook.org/ns/docbook>>
<info>
<dc:title>Eastern World</dc:title>
<dc:creator>Christopher L. Salter</dc:creator>
</info>
<chapter xml:id="ID_9780030995040_CHAPTER01_chap_1" role="chapter">
<title>Chapter 1 A Geographer&#x0027;s World</title>
<!--<pagenums role="" xml:id="p2" type="normal">2</pagenums>-->
<para><emphasis role="bold">What You Will Learn&#x2026;</emphasis></para>
<para>In this chapter you will learn about the field of geography, the study of 
the world&#x0027;s people and places. You will also learn why people study 
geography and how they organize their studies.</para>
<note xml:id="ID_9780030995040_CHAPTER01_note_1">
<title>Focus on Reading and Writing</title>
<para><emphasis role="bold">Using Prior Knowledge</emphasis> Prior knowledge is 
what you already know about a subject. Before you read a chapter, review the 
chapter and section titles. Then make a list of what you already know. Later, 
you can compare your prior knowledge with what you learned from the chapter. 
<emphasis role="bold">See the lesson, Using Prior Knowledge, on page 
668.</emphasis></para>
<para><emphasis role="bold">Writing a Job Description</emphasis> Geographers 
are people who study geography, but what is it exactly that they do? As you 
read this chapter you will learn about the work that geographers do. Then you 
will write a job description that could be included in a career-planning 
guide.</para>
</note>
<mediaobject>
<imageobject>
<imagedata format="jpg" fileref="./images/u01c01/p002_001.jpg" align="left"/>
</imageobject>
</mediaobject>
<sidebar xml:id="ID_9780030995040_CHAPTER01_sidebar_1">
<title>HOLT Geography&#x0027;s Impact
<inlinemediaobject>
<imageobject>
<imagedata format="jpg" fileref="./images/thruout/tv_icon.jpg" align="left"/>
</imageobject></inlinemediaobject></title>
<para><emphasis role="bold">video series</emphasis> Watch the video to 
understand the impact of studying geography.</para>
</sidebar>
<section xml:id="ID_9780030995040_CHAPTER01_sect1_1" role="section" 
standardcode="">
<!--<pagenums role="" xml:id="p4" type="normal">4</pagenums>-->
<title>Section 1 Studying Geography</title>
<para><emphasis role="bold">If YOU lived there&#x2026;</emphasis></para>
<para>You have just moved to Miami, Florida, from your old home in 
Pennsylvania. Everything seems very different&#x2014;from the weather and the 
trees to the way people dress and talk. Even the streets and buildings look 
different. One day you get an e-mail from a friend at your old school. 
&#x201C;What&#x0027;s it like living there?&#x201D; he asks.</para>
<qti:assessmentItem identifier="extendedText" title="" adaptive="false" 
timeDependent="false" label="" standardcode="">
<qti:itemBody><qti:p>How will you describe your new home?</qti:p>
<qti:extendedTextInteraction responseIdentifier="RESPONSE" 
expectedLength="200"/>
</qti:itemBody></qti:assessmentItem>
</section>
</chapter>
</book>

2. Sample X-path Expression

xquery version "1.0-ml";
(: buffer 2 :)
declare namespace html = 
"http://www.w3.org/1999/xhtml";<http://www.w3.org/1999/xhtml>;
doc("/nimas/ch01.xml")/book/chapter/title

Kindly give me a suggestion for this problem.

Thanks & Regards,
Mohanraj D,
Software Programmer,
Laserwords Private Limited,India.
+91-9445451318.



NOTICE: This email message is for the sole use of the intended recipient(s) and 
may contain confidential and privileged information. Any unauthorized review, 
use, disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies of 
the original message.


_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general

Reply via email to