Re: Namespace Issue with InnerXML
- From: Martin Honnen <mahotrash@xxxxxxxx>
- Date: Thu, 17 Jan 2008 16:53:39 +0100
Antoine Fromentin wrote:
Using C# I need to remove the root element of an xml document and keep the inner XML document as is.x
<root xmlns="http://pjc.BizTalk">
<ns0:LaunchStoreUpload xmlns:ns0="http://pjc.schemas">
<Source>
<FTPParams>A</FTPParams>
</Source>
</ns0:LaunchStoreUpload>
</root>
Whatever I try :
root.RemoveAttribute("xmlns", "http://pjc.BizTalk");
root.RemoveAllAttributes();
root.SetAttribute("xmlns", "");
when I use the root.InnerXML I obtain the following result
<ns0:LaunchStoreUpload xmlns:ns0="http://pjc.schemas">
<Source xmlns="http://pjc.BizTalk">
<FTPParams>A</FTPParams>
</Source>
</ns0:LaunchStoreUpload>
That's really not good for me, I don't want the extra xmlns=http://pjc.BizTalk added in the <Source> node
Sorry, your approach can't work, the namespace of an node in the DOM model is determined by its NamespaceURI property and you can't change that. Deleting any xmlns attributes on ancestors does not help, you can't change the namespace of a node.
You might want to look into XSLT to transform the XML. If you need help with that then let us know.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
.
- Follow-Ups:
- Re: Namespace Issue with InnerXML
- From: Antoine Fromentin
- Re: Namespace Issue with InnerXML
- References:
- Namespace Issue with InnerXML
- From: Antoine Fromentin
- Namespace Issue with InnerXML
- Prev by Date: Re: Editting an XML file
- Next by Date: Re: Editting an XML file
- Previous by thread: Namespace Issue with InnerXML
- Next by thread: Re: Namespace Issue with InnerXML
- Index(es):
Relevant Pages
|