How to Remove xml nodes namespaces and prefixes using c#

Questions about XML that are not covered by the other forums should go here.
chandu_king
Posts: 1
Joined: Wed Oct 11, 2017 1:36 pm

How to Remove xml nodes namespaces and prefixes using c#

Post by chandu_king » Wed Oct 11, 2017 2:00 pm

Hello All,

I am facing bit problem with xml manipulation. Can anyone please help me. I need to remove all xml nodes namespace prefixes using c#

my Input is below

<?xml version="1.0" encoding="UTF-8"?>
<Facility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://docs.buildingsmartalliance.org/n ... cobie/core"
core:externalID="3eM8WbY_59RR5TDWry5aRU"

xmlns:core="http://docs.buildingsmartalliance.org/n ... cobie/core"
xmlns:cobielite="http://docs.buildingsmartalliance.org/n ... /cobielite"
core:externalEntityName="IfcBuilding"
core:externalSystemName="Autodesk Revit Architecture 2011"
xsi:schemaLocation="http://docs.buildingsmartalliance.org/n ... /cobielite cobielite.xsd">

<FacilityName>PN 0001</FacilityName>
<FacilityCategory>11-13 24 14: Clinic</FacilityCategory>
<ProjectAssignment core:externalEntityName="IfcProject" core:externalID="3eM8WbY_59RR5TDWry5aRV" core:externalSystemName="Autodesk Revit Architecture 2011">
<ProjectName>Medical-Dental Clinic</ProjectName>
<ProjectDescription>Medical-Dental Clinic</ProjectDescription>
</ProjectAssignment>
<SiteAssignment core:externalEntityName="IfcSite" core:externalID="3eM8WbY_59RR5TDWry5aRT" core:externalSystemName="Autodesk Revit Architecture 2011">
<SiteName>PN 0001</SiteName>
</SiteAssignment>
<FacilityDefaultLinearUnit>meters</FacilityDefaultLinearUnit>
<FacilityDefaultAreaUnit>square meters</FacilityDefaultAreaUnit>
<FacilityDefaultVolumeUnit>cubic meters</FacilityDefaultVolumeUnit>
<FacilityDefaultCurrencyUnit>Dollars</FacilityDefaultCurrencyUnit>
<FacilityDefaultMeasurementStandard>Autodesk Revit Architecture 2011 BIM Area</FacilityDefaultMeasurementStandard>
<FacilityDescription>Medical-Dental Clinic</FacilityDescription>
<FacilityDeliverablePhaseName>Handover</FacilityDeliverablePhaseName>


</Facility>

and my output should be like below
<?xml version="1.0" encoding="UTF-8"?>
<Facility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://docs.buildingsmartalliance.org/n ... /cobielite"
externalID="3eM8WbY_59RR5TDWry5aRU"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<FacilityName>PN 0001</FacilityName>
<FacilityCategory>11-13 24 14: Clinic</FacilityCategory>
<ProjectAssignment externalID="3eM8WbY_59RR5TDWry5aRV" >
<ProjectName>Medical-Dental Clinic</ProjectName>
<ProjectDescription>Medical-Dental Clinic</ProjectDescription>
</ProjectAssignment>
<SiteAssignment externalID="3eM8WbY_59RR5TDWry5aRT" >
<SiteName>PN 0001</SiteName>
</SiteAssignment>
<FacilityDefaultLinearUnit>meters</FacilityDefaultLinearUnit>
<FacilityDefaultAreaUnit>square meters</FacilityDefaultAreaUnit>
<FacilityDefaultVolumeUnit>cubic meters</FacilityDefaultVolumeUnit>
<FacilityDefaultCurrencyUnit>Dollars</FacilityDefaultCurrencyUnit>
<FacilityDefaultMeasurementStandard>Autodesk Revit Architecture 2011 BIM Area</FacilityDefaultMeasurementStandard>
<FacilityDescription>Medical-Dental Clinic</FacilityDescription>
<FacilityDeliverablePhaseName>Handover</FacilityDeliverablePhaseName>

</Facility>

Please help me to achieve this

Thanks in Advance
Chandu

Radu
Posts: 6398
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to Remove xml nodes namespaces and prefixes using c#

Post by Radu » Wed Oct 11, 2017 2:04 pm

Hi,

This forum is dedicated to people who use the Oxygen XML Editor application for editing and processing XML.
As your question is about using C# maybe you could try to ask it on StackOverflow.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply