logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

RE: Serialized namespace prefixes: msg#00040

Subject: RE: Serialized namespace prefixes
The data model defines that a QName is a triple, consisting of prefix, uri,
and local-name. The node-name of an element is a QName, which retains all
three components from the original XML. Your query is selecting the original
node, and then serializing it. Serialization uses the prefix present on the
element node in the data model. (When constructing new elements and
attributes the rules are more complex, but there is no construction involved
here.)

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: talk-bounces-KUd/JJajPrLQT0dZR+AlfA@xxxxxxxxxxxxxxxx 
> [mailto:talk-bounces-KUd/JJajPrLQT0dZR+AlfA@xxxxxxxxxxxxxxxx] On Behalf Of 
> Pierrick Brihaye
> Sent: 29 September 2005 17:38
> To: talk-KUd/JJajPrLQT0dZR+AlfA@xxxxxxxxxxxxxxxx
> Subject: [xquery-talk] Serialized namespace prefixes
> 
> Hi,
> 
> Given the following XML file (called "rdf.rdf") :
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
>           xmlns:dc="http://purl.org/dc/elements/1.1/";
>           xmlns:x="http://exist.sourceforge.net/dc-ext";>
>     <rdf:Description id="3">
>       <dc:title>title</dc:title>
>       <dc:creator>creator</dc:creator>
>       <x:place>place</x:place>
>       <x:edition>place</x:edition>
>    </rdf:Description>
> </rdf:RDF>
> 
> The following XQuery :
> 
> declare namespace x = "http://www.foo.com";;
> let $a := doc("rdf.rdf")
> return $a//x:edition
> 
> ... returns the empty sequence with Saxon 8.5.1.
> 
> This demonstrates that the "declare namespace" statement has 
> precedence 
> over the declarations in the document. Fine.
> 
> Now, the following XQuery :
> 
> declare namespace x = "http://www.foo.com";;
> declare namespace y = "http://exist.sourceforge.net/dc-ext";;
> let $a := doc("rdf.rdf")
> return $a//y:edition
> 
> ... returns :
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <x:edition
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
> xmlns:dc="http://purl.org/dc/elements/1.1/";
> xmlns:x="http://exist.sourceforge.net/dc-ext";>place</x:edition>
> 
> Fine. The document takes the prolog's "declare namespace" 
> statement into 
> account.
> 
> Fine ? Not so sure... why a "x" prefix-binding whereas I 
> asked for a "y" 
> one ?
> 
> Can anybody explain me what happens ?
> 
> Cheers,
> 
> p.b.
> 
> 
> 
> 
> 
> 
> _______________________________________________
> talk-KUd/JJajPrLQT0dZR+AlfA@xxxxxxxxxxxxxxxx
> http://xquery.com/mailman/listinfo/talk
> 




<Prev in Thread] Current Thread [Next in Thread>