本文整理汇总了C#中System.Xml.Linq.XDocument.ToStringFullXmlDeclaration方法的典型用法代码示例。如果您正苦于以下问题:C# XDocument.ToStringFullXmlDeclaration方法的具体用法?C# XDocument.ToStringFullXmlDeclaration怎么用?C# XDocument.ToStringFullXmlDeclaration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Linq.XDocument
的用法示例。
在下文中一共展示了XDocument.ToStringFullXmlDeclaration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePayload
protected override string CreatePayload()
{
/*<?xml version="1.0" encoding="utf-8"?>
<CreateHostedService xmlns="http://schemas.microsoft.com/windowsazure">
<ServiceName>service-name</ServiceName>
<Label>base64-encoded-service-label</Label>
<Description>description</Description>
<Location>location</Location>
<AffinityGroup>affinity-group</AffinityGroup>
</CreateHostedService>*/
XNamespace ns = "http://schemas.microsoft.com/windowsazure";
var locationElement = !string.IsNullOrEmpty(AffinityGroup)
? new XElement(ns + "AffinityGroup", AffinityGroup)
: new XElement(ns + "Location", Location);
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "CreateHostedService",
new XElement(ns + "ServiceName", Name),
new XElement(ns + "Label", Convert.ToBase64String(Encoding.UTF8.GetBytes(Name))),
new XElement(ns + "Description", Description),
locationElement));
return doc.ToStringFullXmlDeclaration();
}
示例2: CreatePayload
//https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deploymentslots/<deployment-slot-name>/?comp=status
/// <summary>
/// The Xml payload that is created and sent to the Fabric with the create deployment parameters
/// </summary>
/// <returns>A string Xml document representation</returns>
protected override string CreatePayload()
{
XNamespace ns = "http://schemas.microsoft.com/windowsazure";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "UpdateDeploymentStatus", new XElement(ns + "Status", Status)));
return doc.ToStringFullXmlDeclaration();
}
示例3: CreatePayload
/// <summary>
/// Creates a deployment payload for a predefined template
/// </summary>
/// <returns>A string xml representation</returns>
/// POST https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/<deployment-name>/roleinstances/<role-name>/Operations
protected override string CreatePayload()
{
/*<RestartRoleOperation xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<OperationType>RestartRoleOperation</OperationType>
</RestartRoleOperation>*/
XNamespace ns = "http://schemas.microsoft.com/windowsazure";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "RestartRoleOperation",
new XElement(ns + "OperationType", "RestartRoleOperation")));
return doc.ToStringFullXmlDeclaration();
}
示例4: CreatePayload
// POST https://management.core.windows.net/<subscription-id>/services/mobileservices/
/// <summary>
/// The Xml payload that is created and sent to the Fabric with the create deployment parameters
/// <?xml version="1.0" encoding="utf-8"?>
/// <Application xmlns="http://schemas.microsoft.com/windowsazure">
/// <Name>##name##</Name>
/// <Label>##label##</Label>
/// <Description>##description##</Description>
/// <Configuration>##spec##</Configuration>
/// </Application>
/// </summary>
/// <returns>A string Xml document representation</returns>
protected override string CreatePayload()
{
XNamespace ns = Namespaces.NsWindowsAzure;
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "Application",
new XElement(ns + "Name", Name.ToLower() + "mobileservice"),
new XElement(ns + "Label", Name.ToLower()),
new XElement(ns + "Description", Description),
new XElement(ns + "Configuration", Config)));
return doc.ToStringFullXmlDeclaration();
}
示例5: CreatePayload
/*<ServerFarm xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Name>DefaultServerFarm</Name>
<NumberOfWorkers>2</NumberOfWorkers>
<WorkerSize>Small</WorkerSize>
</ServerFarm>*/
protected override string CreatePayload()
{
XNamespace xmlns = Namespaces.NsWindowsAzure;
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(xmlns + "Name", Website.ServerFarm.Name),
new XElement(xmlns + "NumberOfWorkers", Website.ServerFarm.InstanceCount),
new XElement(xmlns + "WorkerSize", Website.ServerFarm.InstanceSize));
return doc.ToStringFullXmlDeclaration();
}
示例6: CreatePayload
protected override string CreatePayload()
{
XNamespace ns = "http://schemas.microsoft.com/windowsazure";
XNamespace array = "http://schemas.microsoft.com/2003/10/Serialization/Arrays";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "Site",
new XElement(ns + "HostNames",
new XElement(array + "string", Site.Name + ".azurewebsites.net")),
new XElement(ns + "Name", Name),
new XElement(ns + "State", State.ToString())));
return doc.ToStringFullXmlDeclaration();
}
示例7: CreatePayload
protected override string CreatePayload()
{
XNamespace xmlns = "http://schemas.microsoft.com/2003/10/Serialization/Arrays";
if (!String.IsNullOrEmpty(Uri))
{
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(xmlns + "anyURI", Uri));
return doc.ToStringFullXmlDeclaration();
}
return base.CreatePayload();
}
示例8: CreatePayload
protected override string CreatePayload()
{
/* <?xml version="1.0" encoding="utf-8"?>
<CreateStorageServiceInput xmlns="http://schemas.microsoft.com/windowsazure">
<ServiceName>service-name</ServiceName>
<Description>service-description</Description>
<Label>base64-encoded-label</Label>
<AffinityGroup>affinity-group-name</AffinityGroup>
<Location>location-of-the-storage-account</Location>
</CreateStorageServiceInput>*/
XNamespace ns = "http://schemas.microsoft.com/windowsazure";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "CreateStorageServiceInput",
new XElement(ns + "ServiceName", Name),
new XElement(ns + "Description", Description),
new XElement(ns + "Label", Convert.ToBase64String(Encoding.UTF8.GetBytes(Name))),
new XElement(ns + "Location", Location)));
return doc.ToStringFullXmlDeclaration();
}
示例9: CreatePayload
protected override string CreatePayload()
{
/*<entry xmlns='http://www.w3.org/2005/Atom'>
* <content type='application/xml'>
* <NamespaceDescription xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\">
* <Region>{0}</Region>
* </NamespaceDescription>
* </content>
* </entry>*/
// Serialize NamespaceDescription, if additional properties needs to be specified http://msdn.microsoft.com/en-us/library/jj873988.aspx
XNamespace ns = "http://www.w3.org/2005/Atom";
XNamespace iXmlSchema = "http://www.w3.org/2001/XMLSchema-instance";
XNamespace serviceBusSchema = "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect";
XName i = iXmlSchema + "i";
var doc = new XDocument(
new XElement(ns + "entry",
new XElement(ns + "content", new XAttribute("type", "application/xml"),
new XElement(serviceBusSchema + "NamespaceDescription", new XAttribute(i, "http://www.w3.org/2001/XMLSchema-instance"),
new XElement(serviceBusSchema + "Region", Location)))));
return doc.ToStringFullXmlDeclaration();
}
示例10: CreatePayload
/// <summary>
/// Creates a deployment payload for a predefined template
/// </summary>
/// <returns>A string xml representation</returns>
/// POST https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/<deployment-name>/roleinstances/<role-name>/Operations
protected override string CreatePayload()
{
/*<ShutdownRoleOperation xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<OperationType>ShutdownRoleOperation</OperationType>
* <PostShutdownAction>StoppedDeallocated</PostShutdownAction>
</ShutdownRoleOperation>*/
XNamespace ns = "http://schemas.microsoft.com/windowsazure";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "ShutdownRoleOperation",
new XElement(ns + "OperationType", "ShutdownRoleOperation"),
new XElement(ns + "PostShutdownAction", "StoppedDeallocated")));
return doc.ToStringFullXmlDeclaration();
}
示例11: CreatePayload
//https://management.core.windows.net/<subscription-id>/certificates/
/// <summary>
/// The creation of the XML payload necessary to make the request
/// </summary>
protected override string CreatePayload()
{
XNamespace ns = "http://schemas.microsoft.com/windowsazure";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "CertificateFile",
new XElement(ns + "Data", Base64CertificateData),
new XElement(ns + "CertificateFormat", "pfx"),
new XElement(ns + "Password", PfxPassword)));
return doc.ToStringFullXmlDeclaration();
}
示例12: CreateXmlPayload
/// <summary>
/// Creates an Xml payload for the
/// </summary>
/// <returns>The Xml string</returns>
protected override string CreateXmlPayload()
{
/*<?xml version="1.0" encoding="utf-8"?>
<ChangeConfiguration xmlns="http://schemas.microsoft.com/windowsazure">
<Configuration>base-64-encoded-configuration-file</Configuration>
<TreatWarningsAsError>true|false</TreatWarningsAsError>
<Mode>Auto|Manual</Mode>
<ExtendedProperties>
<ExtendedProperty>
<Name>property-name</Name>
<Value>property-value</Value>
</ExtendedProperty>
</ExtendedProperties>
</ChangeConfiguration>*/
XNamespace ns = "http://schemas.microsoft.com/windowsazure";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "ChangeConfiguration",
new XElement(ns + "Configuration", Convert.ToBase64String(Encoding.UTF8.GetBytes(Configuration.ToString()))),
new XElement(ns + "Mode", "Auto"),
new XElement(ns + "TreatWarningsAsError", true.ToString().ToLower())));
return doc.ToStringFullXmlDeclaration();
}
示例13: BuildXmlPayload
/// <summary>
/// This method builds up wht payload but currently only builds the logging and not the hourly or minute metrics
/// </summary>
private string BuildXmlPayload()
{
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement("StorageServiceProperties",
new XElement("Logging",
new XElement("Version", "1.0"),
new XElement("Delete", "true"),
new XElement("Read", "true"),
new XElement("Write", "true"),
new XElement("RetentionPolicy",
new XElement("Enabled", "true"),
new XElement("Days", "7")))));
return doc.ToStringFullXmlDeclaration();
}
示例14: CreatePayload
/// <summary>
/// Creates a deployment payload for a predefined template
/// </summary>
/// <returns>A string xml representation</returns>
/// POST https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/<deployment-name>/roleinstances/<role-name>/Operations
protected override string CreatePayload()
{
/*<OSImage xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Label>image-label</Label>
<MediaLink>uri-of-the-containing-blob</MediaLink>
<Name>image-name</Name>
<OS>Linux|Windows</OS>
<Eula>image-eula</Eula>
<Description>image-description</Description>
<ImageFamily>image-family</ImageFamily>
<PublishedDate>published-date</PublishedDate>
<IsPremium>true/false</IsPremium>
<ShowInGui>true/false</ShowInGui>
<PrivacyUri>http://www.example.com/privacypolicy.html</PrivacyUri>
<IconUri>http://www.example.com/favicon.png</IconUri>
<RecommendedVMSize>Small/Large/Medium/ExtraLarge</RecommendedVMSize>
<SmallIconUri>http://www.example.com/smallfavicon.png</SmallIconUri>
<Language>language-of-image</Language>
</OSImage>*/
XNamespace ns = "http://schemas.microsoft.com/windowsazure";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "OSImage",
new XElement(ns + "Label", Properties.Label),
new XElement(ns + "MediaLink", Properties.MediaLink),
new XElement(ns + "Name", Properties.Name),
new XElement(ns + "OS", Properties.OperatingSystem.ToString()),
new XElement(ns + "PublishedDate", Properties.PublishedDate.ToString("s")),
new XElement(ns + "IsPremium", Properties.IsPremium.ToString().ToLowerInvariant()),
new XElement(ns + "ShowInGui", Properties.ShowInGui.ToString().ToLowerInvariant())));
return doc.ToStringFullXmlDeclaration();
}
示例15: CreateXmlPayload
protected override string CreateXmlPayload()
{
XNamespace ns = SqlAzureSchema;
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement(ns + "Server",
new XElement(ns + "AdministratorLogin", AdministratorLogin),
new XElement(ns + "AdministratorLoginPassword", AdministratorPassword),
new XElement(ns + "Location", Location)));
return doc.ToStringFullXmlDeclaration();
}