Hi Raghu,

Give use some sample XML file and your existing code sample  to understand the 
scenario .

Thanks and regards
Raja >>>

From: [email protected] 
[mailto:[email protected]] On Behalf Of Raghu
Sent: Wednesday, July 22, 2015 4:27 PM
To: MarkLogic Developer Discussion
Cc: Naga .
Subject: Re: [MarkLogic Dev General] Need to remove unused xml namespace prefix

I understand the concept of namespace and we are allowed to have different 
namespaces inside a single xml apart from the root namespace, IMHO any element 
unless specified otherwise, inherits it's parent's namespace. My question is 
that is there a way where I apply the xpath on a child element, and 
ignore/remove the unused namespace prefix from the resulting xml? One of my 
dependent service is consuming the xml and although, what I'm returning to that 
service is semantically the same as what was saved, these unused prefixes are 
creating an issue. Any help is appreciated.

On Tue, Jul 21, 2015 at 1:30 PM, Asit Nautiyal 
<[email protected]<mailto:[email protected]>> wrote:

Hi Raghu,

Here you want to keep the text.xml as part of "http://somewhere.something.com"; 
namespace and want to make its child element (child) part to other namespace 
""http://anywhere.anything.com<http://anywhere.anything.com/>" , correct me, if 
I am wrong!

If this is the case then, you are making this xml file as ambiguous. In xml 
file , all child elements should belongs to same namespace as its root element, 
that's why we have concept of namespace.

Regards,
Asit Nautiyal
________________________________
Date: Tue, 21 Jul 2015 11:07:53 -0400
From: [email protected]<mailto:[email protected]>
To: [email protected]<mailto:[email protected]>
CC: [email protected]<mailto:[email protected]>
Subject: [MarkLogic Dev General] Need to remove unused xml namespace prefix

HI All,

The following snippet gives me the unused namespace prefix (in this case ns), I 
need to ignore such unused namespace prefixes in the output

Query

declare namespace ns="http://somewhere.something.com";;
xdmp:document-insert
(
"/text.xml",
<ns:root>
<child xmlns="http://anywhere.anything.com";></child>
</ns:root>
);
doc("/text.xml")//*:child

Result

<child xmlns:ns="http://somewhere.something.com"; 
xmlns="http://anywhere.anything.com"/>

Thanks in advance!
Raghu

_______________________________________________ General mailing list 
[email protected]<mailto:[email protected]> Manage 
your subscription at: http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to