내가 시도 :XDocument에 대해 xmlns를 지정하는 방법은 무엇입니까?
textBox1.Text = new XDocument(new XDeclaration("1.0", "UTF-8", "yes"),
new XElement("root1", new XAttribute("xmlns", @"http://example.com"), new XElement("a", "b"))
).ToString();
하지만 내가 얻을 : (내가 찾은 답에 따라)
The prefix '' cannot be redefined from '' to 'http://example.com' within the same start element tag.
가 나는 또한 대체 시도 :
XAttribute(XNamespace.Xmlns,...
을 그러나뿐만 아니라 오류가 발생했습니다.
참고 : 문서에 xmlns가 두 개 이상 없습니다.
어쩌면 당신을 위해이 일 : http://stackoverflow.com/a/2874572/1373170 –