[MarkLogic Dev General]ProbleminsertingdefaultnamespaceincreatedXML document fixed, but validation fails

Lee, David dlee at epocrates.com
Fri Mar 12 05:17:33 PST 2010


No thanks, I understand all that about prefixes and URI's.

I just didn't realize XQuery could do it because I've ran into this in pure XPath before
and couldn't find a way.   If a document uses unprefixed URI's there's no XPath syntax to represent that (to my knowledge). While prefixes are mostly irrelevant, in XPath having a prefix or not is very relevant.
Because there is no way to express "the default namespace" in an XPath (to my knowledge).

The key I re-discovered here is Xquery lets you add that extra glue to define a prefix outside of xpath,
and outside of the document.

I think when I was reading the XQuery specs originally I was glossing over
the namespace issues, then never went back to re-read that part when  I had figured out the language more.



-----Original Message-----
From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Florent Georges
Sent: Friday, March 12, 2010 3:37 AM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General]ProbleminsertingdefaultnamespaceincreatedXML document fixed, but validation fails

"Lee, David" wrote:

> wow thanks ! I didnt know you could do that.  Declare a prefix
> for a namespace to query a non-prefixed document without
> changing the document.

  It seems you misunderstood QNames then, as the prefix is non
relevant.  The name of an element or an attribtue is a QName,
that is the triplet ns-prefix/ns-uri/local-name.  The prefix is
not involved in the comparison of two QNames.  The whole point of
namespaces is to rely only on the namespace URI and the local
name, and let each author (for XML documents, XQuery modules,
etc.) choose his/her own prefixes.

  Hope that helps, regards,

-- 
Florent Georges
http://www.fgeorges.org/


      

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


More information about the General mailing list