XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
rajat nairSubject: Adding a namespace
Author: rajat nair
Date: 07 Jan 2008 05:33 PM
Hi,
I m trying to add a namespace to a document created by the mapping utility,but whn i do declare default namespace like,
declare default element namespace "http://www.openapplications.org/oagis/9";
the result omits all the data grabbed by the mapping and gives only a blank xml even though i have the required namespace added.
This is what i need to be present in the outgoing document,

<ProcessPurchaseOrder xmlns="http://www.openapplications.org/oagis/9" releaseID="9">

I read the following article from datadirect regarding this, but the problem is i do not want to declare a namespace and then use it, because in that case it would have a prefix which may not be recognised by our warehouse software.Any help would be greatly appreciated.

Regards
Rajat Nair

Postnext
Minollo I.Subject: Adding a namespace
Author: Minollo I.
Date: 07 Jan 2008 05:42 PM
Difficult to tell without seeing the XQuery; but maybe you are hitting the issue described here? http://www.xquery.com/tips_and_tricks/xpath_and_namespaces.html

Postnext
Minollo I.Subject: Adding a namespace
Author: Minollo I.
Date: 07 Jan 2008 05:57 PM
...BTW, if that's the problem you are hitting, and you cannot use a prefix for the namespace you are trying to use, probably the easiest way to proceed is to change your XPath expressions (/a/b/c, for example) to use "*:" to make sure they match any namespace... (/*:a/*:b/*:c)

Postnext
rajat nairSubject: Adding a namespace
Author: rajat nair
Date: 08 Jan 2008 04:43 PM
Hi,
The solution mentioned by worked,but i had another question associated with the same issue, hence decided to keep it in the same thread,the default namespace now shows
<ProcessPurchaseOrder xmlns="http://www.openapplications.org/oagis/9">

but the complete information in that tag should also contain a release id, something like this
<ProcessPurchaseOrder xmlns="http://www.openapplications.org/oagis/9" releaseID="9">
How do i go about adding in this extra text?

Regards
Rajat

Postnext
Minollo I.Subject: Adding a namespace
Author: Minollo I.
Date: 08 Jan 2008 04:50 PM
...the same way you would create an attribute for any output element... We don't have your XQuery, so it's difficult to tell you more; maybe you currently have something like...
...
<ProcessPurchaseOrder>
...
</ProcessPurchaseOrder>
...

Then change it to something like:
...
<ProcessPurchaseOrder releaseID="9">
...
</ProcessPurchaseOrder>
...

...or use releaseID="{some expression}" if the value of releaseID needs to be the result of a computed expression.

Posttop
rajat nairSubject: Adding a namespace
Author: rajat nair
Date: 08 Jan 2008 04:56 PM
thanx a ton that did the trick
Regards
Rajat

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.