[MarkLogic Dev General] xhtml loading question

James Clippinger James.Clippinger at marklogic.com
Tue Aug 14 14:04:04 PDT 2007


Dev, you need to include the XHTML namespace in the element QNames you
create for use in the cts:search() if you want the query to match those
elements.  This would work:
 
cts:search(xdmp:directory(('/'),"infinity"),
cts:and-query((cts:element-attribute-value-query(fn:QName("http://www.w3
.org/1999/xhtml", "meta"), xs:QName("name"),
"org"),cts:element-attribute-value-query(fn:QName("http://www.w3.org/199
9/xhtml", "meta"), xs:QName("content"), "abc-de")))) 
 
Note that the attribute QNames don't require namespace URIs because,
having not been prefixed in the original source, they are in the no
namespace.  If you wanted to use the fn:QName() function for
consistency, this form also works:
 
cts:search(xdmp:directory(('/'),"infinity"),
cts:and-query((cts:element-attribute-value-query(fn:QName("http://www.w3
.org/1999/xhtml", "meta"), fn:QName("", "name"),
"org"),cts:element-attribute-value-query(fn:QName("http://www.w3.org/199
9/xhtml", "meta"), fn:QName("", "content"), "abc-de")))) 
 
Regards,
James


________________________________

	From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Devadoss P
	Sent: Tuesday, August 14, 2007 4:49 PM
	To: General Mark Logic Developer Discussion
	Subject: Re: [MarkLogic Dev General] xhtml loading question
	
	
	James,
	 
	This is the query used to load the document,
	xdmp:document-insert("/content/htmlchk66.html",
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en">
	<body> 
	<meta name="org" content="abc-de" />
	<meta name="product" content="electronics" />
	<meta name="education" content="school" />
	<meta name="test" content="answer123" /> 
	</body>
	</html>)
	 
	and my cts query is 
	cts:search(xdmp:directory(('/'),"infinity"),
cts:and-query((cts:element-attribute-value-query(xs:QName("meta"),
xs:QName("name"),
"org"),cts:element-attribute-value-query(xs:QName("meta"),
xs:QName("content"), "abc-de")))) 
	 
	This query returns result, if I load document without xmlns.
	 
	Thanks,
	Dev
	
	 
	On 8/14/07, James Clippinger <James.Clippinger at marklogic.com>
wrote: 

		Dev, can you send the cts:search() call you're using for
your search?
		 
		Thanks,
		James


________________________________

			From: general-bounces at developer.marklogic.com
[mailto: general-bounces at developer.marklogic.com] On Behalf Of Devadoss
P
			Sent: Tuesday, August 14, 2007 4:33 PM 
			To: General Mark Logic Developer Discussion
			Subject: Re: [MarkLogic Dev General] xhtml
loading question
			
			 
			
			James and Mike,
			 
			How to resolve
(xmlns="http://www.w3.org/1999/xhtml") namespace conflict in xquery; I
loaded html document (which has xmlns namespce defined) to MarkLogic and
tried to query its element by using cts:search(), but it returns empty
row. 
			 
			Can you help me to resolve namespace issue?
			 
			Thanks,
			Dev
			
			 
			On 8/14/07, Alex Rice <alexr at santafe.edu> wrote:


				James and Michael:
				
				i had not even thought of namespaces.
now I am getting nodes back and
				can use the declare namespace feature
etc. Thank you both for 
				responding.
				
				Alex Rice
				
				
				On 8/14/07, James Clippinger
<James.Clippinger at marklogic.com > wrote:
				> Alex, I'm not familiar with the XHTML
created by Dreamweaver or UpCast, 
				> but I suspect the XHTML elements both
tools create are in the XHTML
				> namespace.  Try this (keeping in mind
the wildcard-namespace syntax may 
				> be slow):
				>
				>
doc("/SFI/Update/news/articletest2/test.xml")//*:p 
				>
				> If it returns items, you can see which
namespace each item is in and go
				> from there.
				>
				> Regards, 
				> James
				>
	
_______________________________________________
				General mailing list 
				General at developer.marklogic.com
	
http://xqzone.com/mailman/listinfo/general
				



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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20070814/bd75dd19/attachment.html


More information about the General mailing list