nde está o meu XDeclaratio
Por alguma razão, o código a seguir produz XML que não contém uma declaração:
XDocument xDocument = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
new XElement("project",
new XAttribute("number", project.ProjectNumber),
new XElement("store",
new XAttribute("number", project.StoreNumber)
),
// User Element
new XElement("user",
new XAttribute("owner-id", project.OwnerID ?? 0),
new XElement("email", new XCData(project.OwnerEmail ?? "")),
new XElement("project-name", new XCData(project.ProjectName ?? ""))
),
// Nested Project Element
new XElement("nested-project",
new XAttribute("version", new Version(1, 0)),
new XElement("project",
new XAttribute("version", new Version(1, 0)),
xProjectItems = new XElement("project-items")
),
new XElement("price-per-part", project.PricePerPart),
new XElement("sheet-quantity", project.SheetQuantity),
new XElement("edge-length", project.EdgeLength),
new XElement("price", project.Price),
new XElement("status", project.Status),
xMaterialItems = new XElement("alternative-material-items"),
xProductItems = new XElement("project-product-items")
)
)
);
String strXML = xDocument.ToString();
Produziu uma declaração antes. Estou perdendo algo óbvio?
Obrigado