logo       

RE: namespace questions: msg#00019

Subject: RE: namespace questions

> -----Ursprüngliche Nachricht-----
> Von: "Michael Kay" <mhk-uGS4jv4rpPNaa/9Udqfwiw@xxxxxxxxxxxxxxxx>
> Gesendet: 08.05.06 14:06:39
> An: 'Uwe Küssner' <UweKuessner-S0/GAf8tV78@xxxxxxxxxxxxxxxx>
> Betreff: RE: [xquery-talk] namespace questions 


> When I run this with Saxon, from the command line, the output is:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <foo xmlns:sam="http://www.aaa.aaa/a";>
>    <local xmlns="uri">content</local>
> </foo>
> 
> as expected.
> 
> How are you running it?

this is the right question !
i use the oxygenxml plugin for eclipse.
when i use saxon from command line the output is as  expected  :-)
thank you.

uwe küsssner

----------------------------------------------------------------------------


> 
> I would regard any serializer that doesn't output the namespace declarations
> as seriously buggy.
> 
> Michael Kay
> http://www.saxonica.com/ 
> 
> > -----Original Message-----
> > From: Uwe Küssner [mailto:UweKuessner-S0/GAf8tV78@xxxxxxxxxxxxxxxx] 
> > Sent: 08 May 2006 12:32
> > To: Michael Kay; talk-KUd/JJajPrLQT0dZR+AlfA@xxxxxxxxxxxxxxxx
> > Subject: RE: [xquery-talk] namespace questions 
> > 
> > dear michael kay,
> > 
> > thank you for your answer, as far as I understand you, something like
> > 
> > let $x := element {QName('uri', 'local')} { 'content' } 
> > return <foo xmlns:sam="http://www.aaa.aaa/a";> {$x} </foo>
> > 
> > should do the job. right ?
> > but the result is:
> > 
> > <foo>
> >     <local>content</local>
> > </foo>
> > 
> > both namespaces are not present.
> > is it because i have to configure the serialization (with 
> > saxon), as Martin Probst said ?
> > 
> > probst >his is a serialization issue and depends on the 
> > implementation you probst >use. I.e. in X-Hive a simple 
> > .toString() on an XML element won't add probst >XML namespace 
> > declarations, but you can always use an XML serializer probst 
> > >and set DomConfiguration.FEATURE_NAMESPACES to true in its config.
> > 
> > thank you.
> > 
> > uwe kuessner
> > 
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: "Michael Kay" <mhk-uGS4jv4rpPNaa/9Udqfwiw@xxxxxxxxxxxxxxxx>
> > > Gesendet: 08.05.06 10:23:27
> > > An:  <talk-KUd/JJajPrLQT0dZR+AlfA@xxxxxxxxxxxxxxxx>
> > > Betreff: RE: [xquery-talk] namespace questions
> > 
> > 
> > > > I use the follwing xquery:
> > > > 
> > > > declare namespace sam="http://www.aaa.aaa/a";; declare 
> > > > namespace huhu="http://www.aaa.aaa/b";; let $extern := <a 
> > > > namespace="huhu"/> return
> > > >    <foo>
> > > >         <sam:bar/>
> > > >         {element {concat($extern/@namespace,":","ele")} {"text"}}
> > > >         </foo>
> > > > 
> > > > which generates:
> > > > 
> > > > <foo>
> > > >     <sam:bar/>
> > > >     <huhu:ele>text</huhu:ele>
> > > > </foo>
> > > > 
> > > > Questions:
> > > > 1.      What is necessary to create the missing namespace 
> > > > declarations xmlns:sam=?http://www.aaa.aaa/a?  in the foo 
> > element ?
> > > 
> > > Write <foo xmlns:sam="http://www.aaa.aaa/a"/>.
> > > 
> > > There are two kinds of namespace declarations in XQuery. 
> > "declare namespace"
> > > defines a namespace binding that can be used anywhere in 
> > the query, but
> > > which is not copied into constructed elements. An 
> > xmlns="xyz" declaration in
> > > a direct element constructor defines a binding that can be 
> > used anywhere
> > > lexically within that element constructor, and which is 
> > also copied to the
> > > result element.
> > > 
> > > > 2. If the second line  (declare namespace 
> > > > huhu=http://www.aaa.aaa/b?; is missing ) there is a runtime 
> > > > error. (Undeclared prefix in element name:huhu). If the 
> > > > prefix ?huhu? of the namespace is not known in advance, but 
> > > > only at run time, is it still possible to construct a node 
> > > > ?<huhu:ele>? ?
> > > 
> > > Yes, supply a value of type xs:QName(), which you can 
> > construct dynamically
> > > if you know the namespace URI and local name.
> > > 
> > > element {QName('uri', 'local')} { content }
> > > 
> > > Michael Kay
> > > http://www.saxonica.com/
> > > 
> > 
> > 
> 





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
region.costa-ri...    user-groups.lin...    lang.prothon.us...    xfree86.cvs/200...    finance.aqbanki...    ietf.smtp/1993-...    web.turbogears....    jakarta.cactus....    yellowdog.gener...    php.gtk+.genera...    org.region.indo...    hurd.l4/2005-10...    culture.religio...    apple.fink.gene...    db.mysql.window...    bluez.devel/200...    security.pgp-ba...    video.blender.d...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe