반응형
XmlDocument-문자열에서로드 하시겠습니까?
protected void Page_Load(object sender, EventArgs e)
{
XmlDocument doc = new XmlDocument();
try
{
string path = Server.MapPath(".");
doc.Load(path+"whatever.xml");
}
catch (Exception ex)
{
lblError.Text = ex.ToString();
return;
}
// Convert XML to a JSON string
string JSON = XmlToJSON(doc);
// Replace \ with \\ because string is being decoded twice
JSON = JSON.Replace(@"\", @"\\");
// Insert code to process JSON at end of page
ClientScriptManager cs = Page.ClientScript;
cs.RegisterStartupScript(GetType(), "SpaceJSON", "space_processJSON('" + JSON + "');", true);
}
파일에서 xml을로드하는 대신 문자열에서 어떻게로드합니까?
XmlDocument doc = new XmlDocument();
doc.LoadXml(str);
str
XML 문자열은 어디에 있습니까 ? 자세한 내용은 MSDN 문서 를 참조하십시오.
참고 URL : https://stackoverflow.com/questions/4929653/xmldocument-load-from-string
반응형
'Programing' 카테고리의 다른 글
한 번의 호출로 그룹별로 여러 변수에 여러 요약 함수 적용 (0) | 2020.09.20 |
---|---|
Where 절의 SQL Row_Number () 함수 (0) | 2020.09.20 |
* nix에서 ipython에서 vi 키를 어떻게 사용합니까? (0) | 2020.09.20 |
Nuget의 모범 사례 : 디버그 또는 릴리스? (0) | 2020.09.19 |
교차 도메인 iframe 크기 조정 (0) | 2020.09.19 |