Re: Namespace Issue with InnerXML
- From: "Antoine Fromentin" <afromentin@xxxxxxxxxxxxx>
- Date: Thu, 17 Jan 2008 14:44:14 -0500
Thanks,
I know understand why I would need to transform the XML using XSLT.
I'm sure it's probably not a complex XSLT that can remove the root element
of an XML file but as I never used XMLT....
My real XML file is more complex , I'd like to create a generic XSLT which
only removes the root element.
Does someone knows a good reference to work with...
Thanks,
Antoine
"Martin Honnen" <mahotrash@xxxxxxxx> wrote in message
news:%23v%23UiESWIHA.4548@xxxxxxxxxxxxxxxxxxxxxxx
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: Martin Honnen
- Re: Namespace Issue with InnerXML
- References:
- Namespace Issue with InnerXML
- From: Antoine Fromentin
- Re: Namespace Issue with InnerXML
- From: Martin Honnen
- Namespace Issue with InnerXML
- Prev by Date: Re: Editting an XML file
- Next by Date: Re: Ping MS: Re: XmlDiffPatch Tools Lost with gotdotnot demise
- Previous by thread: Re: Namespace Issue with InnerXML
- Next by thread: Re: Namespace Issue with InnerXML
- Index(es):
Relevant Pages
|