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

How to Remove xml nodes namespaces and prefixes using c#

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/nbims03/cobie/core"
core:externalID="3eM8WbY_59RR5TDWry5aRU"

xmlns:core="http://docs.buildingsmartalliance.org/nbims03/cobie/core"
xmlns:cobielite="http://docs.buildingsmartalliance.org/nbims03/cobie/cobielite"
core:externalEntityName="IfcBuilding"
core:externalSystemName="Autodesk Revit Architecture 2011"
xsi:schemaLocation="http://docs.buildingsmartalliance.org/nbims03/cobie/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/nbims03/cobie/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: 5096

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

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

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest