xElement
(C# 言語)を生成する次のコードを開発しました。
new XElement("Transmission",
new XAttribute(XNamespace.Xmlns.GetName("xmlns").LocalName, "http://www.irs.gov/efile"),
new XAttribute(XNamespace.Xmlns + "xsi", xsi),
new XAttribute(xsi + "schemaLocation", schemaLocation),
........
3 つの名前空間は次のように宣言されます。
private static XNamespace xsi = XNamespace.Get("http://www.w3.org/2001/XMLSchema-instance");
private static XNamespace schemaLocation = XNamespace.Get("http://www.irs.gov/efile ./ExtendedCommon/Transmission.xsd");
private static XNamespace xmlnsLocation = XNamespace.Get("http://www.irs.gov/efile");
しかし、これから xml を生成すると、次のエラーが発生します。
The prefix '' cannot be redefined from '' to 'http://www.irs.gov/efile' within the same start element tag.
誰か助けてくれませんか?