Skip to content

Instantly share code, notes, and snippets.

@jinweijie
Created July 18, 2012 01:23
Show Gist options
  • Save jinweijie/3133453 to your computer and use it in GitHub Desktop.
Save jinweijie/3133453 to your computer and use it in GitHub Desktop.
create XElement with namespace
public static string ParameterXml
{
get
{
XNamespace xsd = "http://www.w3.org/2001/XMLSchema";
XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
XNamespace rs = "http://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices";
XElement root = new XElement("ScheduleDefinition",
new XAttribute(XNamespace.Xmlns + "xsd", "http://www.w3.org/2001/XMLSchema"),
new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"),
new XElement(rs + "StartDateTime", "time_time_time"),
new XElement(rs + "MonthlyRecurrence",
new XElement(rs + "Days", "1,3-6"),
new XElement(rs + "MonthsOfYear"))
);
root.Descendants(rs + "MonthsOfYear").First().Add(
new XElement(rs + "Feb", "true") );
Console.WriteLine();
return root.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment