Link to home
Start Free TrialLog in
Avatar of verintsupport
verintsupport

asked on

how can i get rid of this field in my XML? xmlns=""

This code is giving me an unknown attrib and i don't understand why?

XmlNode el_folder = m_InPutXml.GetElementsByTagName("Folder")[0];
                  
XmlElement el_placemark = m_InPutXml.CreateElement("Placemark");
el_folder.AppendChild(el_placemark);

result:
<Placemark xmlns="">
</Placemark>

it should be:
<Placemark>
</Placemark>

thanks!

Richard
Avatar of dungla
dungla
Flag of Viet Nam image

Hi verintsupport,

Can you paste the original XML file?
Avatar of verintsupport
verintsupport

ASKER

Thanks dungla

Following your request, i noticed that this file has a xmlns="xxx" attrib in the root. (see below)

How could i remove it?

Thanks

Richard

----------Original XML-------------------
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="xxx">
  <Document>
    <name>5510.kml</name>
    <Folder>
      <name>5510</name>
      <open>1</open>
    </Folder>
  </Document>
</kml>

----------RESULT-------------------
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="xxx">
  <Document>
    <name>5510.kml</name>
    <Folder>
      <name>5510</name>
      <open>1</open>
      <Placemark xmlns="">
        <name>5510</name>
        <LineString>
          <altitudeMode>xxx</altitudeMode>
          <coordinates>xxx</coordinates>
        </LineString>
        <tessellate>1</tessellate>
        <description><![CDATA[<Verint><NextMod>S1100</NextMod></Verint>]]></description>
      </Placemark>
    </Folder>
  </Document>
</kml>
I forgot to wirte that by removing it manually... it doent create this attrib anymore.

How could i remove it easilly when reading the file?  I don't need it...  


i'm very new to c#


Thanks

Richard
Is there a way to edit the XML as a text file before reading it as an XML?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of dungla
dungla
Flag of Viet Nam image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you Dungla!

You really helped me! It's working!

Richard
:) You're welcome Richard