XML 파일은 아직 시작 단계입니다. 나는 XML과 디렉토리를 만들려면 나는이 기능을 가지고 : RunCommand가 comanda_cmd 첫 번째, 두 번째입니다 문자열XML 가져 오기 및 디렉토리 만들기 C#
private void ProcesNode(XmlNode node, string parentPath, string path, string first, string second, string BuiltUnit, string item)
{
if (!node.HasChildNodes || ((node.ChildNodes.Count == 2) && (node.FirstChild is System.Xml.XmlText)))
{
//MessageBox.Show(parentPath + "/" + node.Name);
}
else
{
foreach (XmlNode child in node.ChildNodes)
{
comanda_cmd = first + "/" + parentPath + second + "/" + parentPath + "/" + node.Name;
string status = RunCommand(comanda_cmd + "/project.pj /n");
//content = "_GEN_PROJECT/" + ProjectName + "/" + BuiltUnit + "/" + item + "/" + parentPath + "/" + node.Name + " already exist";
//MessageBox.Show(content);
//check_status(status, content);
ProcesNode(child, parentPath + "/" + node.Name, path, first, second, BuiltUnit, item);
}
}
}
을 실행하는 기능입니다
을 그리고 나는이 XML이 :
<unit>
<Unit1>
<src>
<i>
<test1>
<test_in1>
<test_in_out>
<t>
</t>
</test_in_out>
</test_in1>
</test1>
<test2>
<test_in2>
</test_in2>
</test2>
</i>
</src>
<doc>
<i>
<test1>
<test_in1>
<test_in_out>
<t>
</t>
</test_in_out>
</test_in1>
</test1>
<test2>
<test_in2>
</test_in2>
</test2>
</i>
</doc>
</Unit1>
<Unit2>
<src>
<i>
</i>
</src>
</Unit2>
</unit>
을
ProcesNode를 호출하고 디렉토리를 만듭니다. 예 : unit/Unit1/src/i/test1/test_in1/test_in_out 하지만 마지막 디렉토리 (내 경우 "t")는 생성되지 않습니다.
어디서 잘못 되었나요? 마지막 디렉토리를 만들지 않는 이유는 무엇입니까?
가장 낮은 태그 ('')의 경우, 'if' 조건'(! node.HasChildren || ...)'는'true'이므로 디렉토리를 만드는'else' 블록을 입력하지 마십시오. –
당신 말이 맞아요! 엄청난 감사를 보낸 Rene Vogt –