[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

XmlTextWriter - write without the "xmlns" attributes - vb.net

Posted on 2007-07-21
2
Medium Priority
?
2,147 Views
Last Modified: 2013-11-07
Hi all,
I'm using xmlTextWriter to create an XML file. I would like to know how to disable the XMLNS attributes added automatically to my tags?
When I create a new xml, these XMLNS are being added automatically, and giving me trouble later on...

Is there anyway to disable it?

* using vb.net

Thanks in advance
0
Comment
Question by:nahumba
2 Comments
 
LVL 2

Accepted Solution

by:
sakshi_net earned 2000 total points
ID: 19540249
I have created a sample code in page load

Dim writer As New XmlTextWriter("C:\test.xml", System.Text.Encoding.UTF8)

        'Start Document
        writer.WriteStartDocument()
        writer.WriteStartElement("RootTag")

        ' 'Creating the First Element
        writer.WriteStartElement("EmployeeInfo")
        writer.WriteAttributeString("EmpDept", "IT")
        writer.WriteElementString("EmpCode", "123")
        writer.WriteElementString("EmpName", "Sakshi_net")
        writer.WriteEndElement()

        'Creating the Second Element
        writer.WriteStartElement("ProjectInfo")
        writer.WriteElementString("ProjCode", "PR12")
        writer.WriteElementString("ProjName", "CTT")
        writer.WriteEndElement()

        writer.WriteEndElement()
        writer.WriteEndDocument()
        writer.Close()

this creates following xml file with no xmlns tags..
 <?xml version="1.0" encoding="utf-8" ?>
- <RootTag>
- <EmployeeInfo EmpDept="IT">
  <EmpCode>123</EmpCode>
  <EmpName>Sakshi_net</EmpName>
  </EmployeeInfo>
- <ProjectInfo>
  <ProjCode>PR12</ProjCode>
  <ProjName>CTT</ProjName>
  </ProjectInfo>
  </RootTag>

----------
what exactly you are using with xmltextwriter
0
 

Author Comment

by:nahumba
ID: 19540293
Hi sakshi_net, that's exactly what I was looking for! Thanks you so much!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month19 days, 10 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question