本文整理汇总了C#中System.Xml.Linq.XDocument.Encode方法的典型用法代码示例。如果您正苦于以下问题:C# XDocument.Encode方法的具体用法?C# XDocument.Encode怎么用?C# XDocument.Encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Linq.XDocument
的用法示例。
在下文中一共展示了XDocument.Encode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRequestContent
private static byte[] GetRequestContent(String username, String password, String application, String accessKey, String privateAccessKey, Encoding encoding)
{
XDocument document = new XDocument(new XDeclaration("1.0", encoding.BodyName, "yes"));
XElement root = new XElement("appAuthorization");
XElement userNameElement = new XElement("username");
userNameElement.SetValue(username);
root.Add(userNameElement);
XElement passwordElement = new XElement("password");
passwordElement.SetValue(password);
root.Add(passwordElement);
XElement appElement = new XElement("application");
appElement.SetValue(application);
root.Add(appElement);
XElement accessKeyElement = new XElement("accessKeyId");
accessKeyElement.SetValue(accessKey);
root.Add(accessKeyElement);
XElement privateAccessKeyElement = new XElement("privateAccessKey");
privateAccessKeyElement.SetValue(privateAccessKey);
root.Add(privateAccessKeyElement);
document.Add(root);
return document.Encode(encoding);
}
示例2: GetCreateFileRequestContent
private static byte[] GetCreateFileRequestContent(String displayName, String mediaType, Encoding encoding)
{
XDocument document = new XDocument(new XDeclaration("1.0", encoding.BodyName, "yes"));
XElement root = new XElement("file");
XElement displayNameElement = new XElement("displayName");
displayNameElement.SetValue(displayName);
root.Add(displayNameElement);
XElement mediaTypeElement = new XElement("mediaType");
mediaTypeElement.SetValue(mediaType);
root.Add(mediaTypeElement);
document.Add(root);
return document.Encode(encoding);
}
示例3: GetRequestContent
private static byte[] GetRequestContent(String accessKeyId, String privateAccessKey, String refreshToken, Encoding encoding)
{
XDocument document = new XDocument(new XDeclaration("1.0", encoding.BodyName, "yes"));
XElement root = new XElement("tokenAuthRequest");
XElement accessKeyElement = new XElement("accessKeyId");
accessKeyElement.SetValue(accessKeyId);
root.Add(accessKeyElement);
XElement privateAccessKeyElement = new XElement("privateAccessKey");
privateAccessKeyElement.SetValue(privateAccessKey);
root.Add(privateAccessKeyElement);
XElement refreshTokenElement = new XElement("refreshToken");
refreshTokenElement.SetValue(refreshToken);
root.Add(refreshTokenElement);
document.Add(root);
return document.Encode(encoding);
}