Created
July 18, 2012 01:23
-
-
Save jinweijie/3133453 to your computer and use it in GitHub Desktop.
create XElement with namespace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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