0

Here I wish to add a namespace to the forst line of xml document i.e

<?xml version="1.0" encoding="utf-8"?> 

I am creating the xml file using c# with the help of syndicate rss feed. it should be like

<?xml version="1.0" encoding="utf-8" xmlns:example="www.example.com ?> 
6
  • 1
    The namespace should be added to the root tag and not the identification line. Commented Jul 26, 2017 at 13:11
  • another good post stackoverflow.com/questions/7601759/… Commented Jul 26, 2017 at 13:16
  • That line is called the XML Preamble. Commented Jul 26, 2017 at 13:16
  • Hello will,the question is different i think because i have a different scenario Commented Jul 26, 2017 at 13:16
  • @Ma6139735 The solution to the marked question answers this one. The different "scenario" is irrelevant. Commented Jul 26, 2017 at 14:04

1 Answer 1

1

You can use the xmlns attribute to add the namespace like

doc.DocumentElement.SetAttribute("xmlns", "www.example.com");
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.