我是亚马逊s3的新手,并试图将遗留代码方法更改为s3等效方法。代码是这样的:
public static System.Xml.XmlDocument GetXmlDocument(string path)
{
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
using (UNCAccess ua = new UNCAccess(GetDirectoryPath(path)))
{
if (FileExists(path)) xmlDoc.Load(path);
}
return xmlDoc;
}
我已将上述代码更改为:
public static System.Xml.XmlDocument GetXmlDocument(string path, string key)
{
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
AWSS3File aws = new AWSS3File();
path = path.Replace("\\", "/");
path = path.Replace(aws.awsBucketName + "/", "");
if (!aws.DirectoryExists(path))
{
using (aws.client = aws.GetS3Client())
{
if (aws.FileExists(key))
xmlDoc.Load(path);
}
}
return xmlDoc;
//System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
//using (UNCAccess ua = new UNCAccess(GetDirectoryPath(path)))
//{
// if (FileExists(path)) xmlDoc.Load(path);
//}
//return xmlDoc;
}
但由于此处的返回类型是系统返回类型,因此它不适合s3。我只是想知道xml文档是否有s3等效的返回类型?
欢迎任何建议,并提前感谢您:)